YDataSource problems
18 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Paulo Silva
2011 年 7 月 9 日
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?
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!