how to plot animated 2D figure using time axis and function in gui matlab ?

I'm trying to plot animated plot using many functions like addpoints but it doesnot work in guide .how can i solve this problem and plot 2d graph using function and time axis.

5 Comments

Mostafa - please provide more details. Are you trying to plot something in real-time? Where is the data coming from (that you wish to plot)?
For example X=0:0.01:9; Y=h*i*3; Plot(X, Y) ; I need to plot this with animation plot in guide matlab can i do this?
How to plot with animation plot in gui
Anything, i just need to animation figure in gui like wave moving

Sign in to comment.

 Accepted Answer

Mostafa - perhaps the following can be adapted for your needs
x = linspace(-2*pi,2*pi,1000);
y = sin(x);
figure;
hPlot = plot(NaN,NaN);
xlim([min(x) max(x)]);
ylim([min(y) max(y)]);
for k = 1:length(x)
set(hPlot, 'XData', [get(hPlot,'XData') x(k)], 'YData', [get(hPlot,'YData') y(k)]);
pause(0.001);
end

2 Comments

It can be...so long as your GUI has an axes you can make sure the plot, xlim, and ylim functions are set fot that axes.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!