Problem with refreshdata in GUI

4 ビュー (過去 30 日間)
Kostbone
Kostbone 2011 年 8 月 25 日
heya, i know there is similar question as mine, but i couldnt use it for solution
So ill try to ask you base on my problem
First of all i made animation in script(m file), and it works perfectly, but i want to embedd it in GUI, and then problems started
I want to get animation in axes plot, and simply i dont know how to use refreshdata properly or maybe problem is somewhere else
This is part of code:
axes(handles.axes3)...
lines of code to draw something on axes (it works)
...
vel=length(evalin('base','h1'));
h1=evalin('base','h1');
h2=evalin('base','h2');
h10=evalin('base','h10');
h20=evalin('base','h20');
x1=[0.1 0.1+z1];
y1=[h10 h10];
x2=[0.1+z1+0.2 z1+0.1+0.2+z2];
y2=[h20 h20];
s1=area(x1,y1);
s2=area(x2,y2);
set(s1,'YDataSource','y1')
set(s2,'YDataSource','y2')
for j=1:vel
y1=[h1(j) h1(j)];
y2=[h2(j) h2(j)];
refreshdata
drawnow
end
As you can see, i have to get datas from Workspace, so i can use them in loop, and so i can use them to draw in axes plot.
So basicly i want that "area" function to be redrawn, each iteration of loop
Just to introduce in code:
h1 and h2 are arrays of about 300 datas, z1 and z2 are just datas for drawing
i think everything else is clear, also if you need more code or more infos pls write me, since i really dont know how to solve this problem
Thank you in advance!

採用された回答

Oleg Komarov
Oleg Komarov 2011 年 8 月 25 日
Sustitute inside the loop with:
set(s1,'Ydata',[h1(j) h1(j)])
set(s2,'Ydata',[h2(j) h2(j)])
pause(.1)
  2 件のコメント
Kostbone
Kostbone 2011 年 8 月 25 日
ty very much it works perfectly, but if you have time and will, can you explain me why my source code didnt work inside gui, but it worked as standalone m file?
Sry for bothering but i just want to learn basics properly :)
Oleg Komarov
Oleg Komarov 2011 年 8 月 25 日
Try refreshdata(object_handles,'caller')

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by