Using nested for loop to alter a previous matrix
1 view (last 30 days)
Show older comments
I need to define a 5x5 matrix with all zeros, then use a nested for loop to alter that matrix to look like
How do I go about doing this? I understand that I need to have some sort of counter to go up as each element increases down the column.
0 Comments
Answers (1)
Rik
on 18 Mar 2018
Is this homework? If not, why not avoid a loop:
A =1:25;
A2=reshape(A,5,5);
2 Comments
Image Analyst
on 18 Mar 2018
Since it's homework, which means you're not allowed to turn in Birdman's code as your own (lest you get caught "cheating"), then you should have tagged it as homework in advance. But it should be easy for you to do something very similar so that it's your own work you're turning in.
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!