Using for loops for a matrix

The question is:
'Using a for loop, create as many figure windows as there are rows in the matrix and plot the numbers from each row in a seperate figure window.'
I have a matrix with four rows, how do I go about doing this?

 Accepted Answer

Just use a for-loop. For example
M = rand(10, 40);
for i = 1:size(M,1)
figure();
plot(M(i,:));
end

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Release

R2020b

Asked:

Liz
on 30 Nov 2020

Answered:

on 30 Nov 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!