Small Satellites

Home » Math » Basic MATLAB

Basic MATLAB

Using the break command to stop the while loop for given condition

t = 1;
while 1 % infinite loop
t = t+1;
    if (t > 1000 ) % condition
        break      % break the loop
    end
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

Recent Post

%d bloggers like this: