Using for loops to generate an array?
Show older comments
I need to generate the array A = 1 2 3 4 5; 2 4 6 8 10; 3 6 9 12 15; 4 8 12 16 20; 5 10 15 20 25; using for loops. Don't have much experience with looping, and currently trying to understand it until it clicks. Help!
Accepted Answer
More Answers (1)
Matt Tearle
on 6 Nov 2015
0 votes
TastyPastry's answer is perfectly correct, but it's worth asking an important clarification: why do you want to do it with a for-loop? This can be done far more neatly in MATLAB without any loops.
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!