update MatLab graph/plot in real time

pause function works well to call graph/plot in a loop.

Suppose, you want to show a sequence of images in a for loop. If processes in a loop is not heavy, imshow() only shows image after the loop has executed. The code spends enough time to show images. This can be done by pause() function that halts execution as
for n = 1:10
img = imread( [ ‘image’ num2str(n) ‘.bmp’ ] );
imshow(img);
pause(0.5); % execution is halted for 0.5 seconds
end

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s