Problem with refreshdata in GUI
4 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!