How to plot data inside a for loop?

3 views (last 30 days)
Sampath reddy
Sampath reddy on 5 May 2012
I would like to know how to plot a graph in a GUI like a scope or moving graph as the data point is simulated inside a for loop. and also how to move x-axis which is time in my problem along with the graph. For example how to plot a moving sin wave with respect to time.

Answers (1)

Wayne King
Wayne King on 5 May 2012
A simple way:
n = 0:199;
for nn = 1:length(n)
axis([1 100 -1 1]);
hold on;

Sign in to comment.


Find more on Labels and Annotations in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!