Matlab: Control Statements<br />
Conditional Statements<br />If - elseif – else<br />while<br />for<br />
‘if, elseif, else’<br />If &lt;condition is met&gt;<br />	then do this<br />else<br />	do this<br />end<br />
‘if, elseif, else’<br />If &lt;condition is met&gt;<br />	then do this<br />elseif &lt;other condition met&gt;<br />	do th...
while<br />The statements inside the ‘while’ loop will keep executing repeatedly till the condition is false.<br />while &...
while<br />while &lt;condition&gt;<br />	//keep repeating<br />	.<br />	.<br />end<br />
for<br />for variable = initval:endval<br />	statement <br />... <br />	statement<br />end<br />The statements inside the ...
for<br />input<br />output<br />
Visit more self help tutorials<br />Pick a tutorial of your choice and browse through it at your own pace.<br />The tutori...
Upcoming SlideShare
Loading in...5
×

Matlab: Control Statements

1,999

Published on

Matlab: Control Statements

Published in: Technology, Travel
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,999
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Matlab: Control Statements

  1. 1. Matlab: Control Statements<br />
  2. 2. Conditional Statements<br />If - elseif – else<br />while<br />for<br />
  3. 3. ‘if, elseif, else’<br />If &lt;condition is met&gt;<br /> then do this<br />else<br /> do this<br />end<br />
  4. 4. ‘if, elseif, else’<br />If &lt;condition is met&gt;<br /> then do this<br />elseif &lt;other condition met&gt;<br /> do this<br />elseif &lt;other condition met&gt;<br /> do this<br />else<br /> do this<br />end<br />
  5. 5. while<br />The statements inside the ‘while’ loop will keep executing repeatedly till the condition is false.<br />while &lt;condition&gt;<br /> //keep repeating till above condition is met<br /> .<br /> .<br />end<br />
  6. 6. while<br />while &lt;condition&gt;<br /> //keep repeating<br /> .<br /> .<br />end<br />
  7. 7. for<br />for variable = initval:endval<br /> statement <br />... <br /> statement<br />end<br />The statements inside the ‘for’ loop will be exectuted repeatedly till the variable reaches ‘endvalue’ as defined in the declaration. At each successive cycle, the variable is incremented/decremented by one unit so as to change it from the initial value to the final value progressively. <br />
  8. 8. for<br />input<br />output<br />
  9. 9. Visit more self help tutorials<br />Pick a tutorial of your choice and browse through it at your own pace.<br />The tutorials section is free, self-guiding and will not involve any additional support.<br />Visit us at www.dataminingtools.net<br />

×