I'm trying to update new values to a function using the 'set' function.
Here is the code:
daq_object = analoginput('winsound');
chan = addchannel(daq_object,1);
x=[10];
num_samples = 1000;
axes(handles.axes1);
plot_handle=surf(T,F,10*log10(P),'edgecolor','none');
axis tight;
view(0,90);
xlabel('Time (Seconds)'); ylabel('Hz');
set(daq_object,'SamplesPerTrigger',inf,'SamplesAcquiredFcnCount',num_samples,...
'SamplesAcquiredFcn',{@update_plot,handles});
function update_plot(handles)
data = getdata(daq_object,num_samples);
[S,F,T,P] = spectrogram(data,256,250,256,1E3);
set(plot_handle,'YData',T,F,P); % ERROR WITH THIS, UPDATING THE VARIABLES.
end
The error is that, I don't know how to update multiple variables in a function. for one variable ex:
h=plot(zeros(100,2));
for i=1:20
set(h,'Ydata',rand(10,1));
drawnow;
end
but here I need to update the T,F and P values. How can I use SET to do that?
I tried:
set(plot_handle,'YData',T,F,P);
but thats just giving me errors.
analoginputfrom the Data Acquisition toolbox. Since many people who might answer you (including myself) don't have access to this toolbox, could your provide an example which uses base MATLAB? - Richie Cotton