Upcoming SlideShare
×

# Matlab: Control Statements

2,723 views

Published on

Matlab: Control Statements

Published in: Technology, Travel
2 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
2,723
On SlideShare
0
From Embeds
0
Number of Embeds
97
Actions
Shares
0
0
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 />