YDataSource problems
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi there,
I'm trying to create an animated plot with data from four sensors. I got it to work with the data from one sensor using the refreshdata command. However, refreshdata didn't like plotting more than one column of data. I was hoping that the following code would work, but I get the error:
??? Error using ==> set Invalid handle object.
Error in ==> guiTest>pushbutton_Play_Callback at 450 set(h1,'YDataSource','handles.y1')
What am I doing wrong... and maybe more to the point... what's the best way to plot multiple lines in the same graph and then update it many times/sec?
A snippet of code is below. Thanks!
handles.y1 = rawData(handles.x,1);
handles.y2 = rawData(handles.x,2);
handles.y3 = rawData(handles.x,3);
handles.y4 = rawData(handles.x,4);
h1 = plot(handles.data,handles.x,handles.y1);
h2 = plot(handles.data,handles.x,handles.y2);
h3 = plot(handles.data,handles.x,handles.y3);
h4 = plot(handles.data,handles.x,handles.y4);
set(h1,'YDataSource','handles.y1')
set(h1,'XDataSource','handles.x')
set(h2,'YDataSource','handles.y2')
set(h2,'XDataSource','handles.x')
set(h3,'YDataSource','handles.y3')
set(h3,'XDataSource','handles.x')
set(h4,'YDataSource','handles.y4')
set(h4,'XDataSource','handles.x')
0 Kommentare
Antworten (1)
Paulo Silva
am 9 Jul. 2011
Use lines instead of plots and change their xdata and ydata everytime you want to update them.
I can't understand that code, you are changing the datasource for what purpose?
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!