ElectroGram
Thursday, 28 July 2016
MATLAB Programming 37 - nesting of loops
The Nested Loops
MATLAB allows to use one loop inside another loop. Following section shows few examples to illustrate the concept.
Syntax
The syntax for a nested for loop statement in MATLAB is as follows:
for m = 1:j
for n = 1:k
<statements>;
end
end
The syntax for a nested while loop statement in MATLAB is as follows:
while <expression1>
while <expression2>
<statements>
end
end
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment