How to save output in array
2 views (last 30 days)
Show older comments
Hi, I'm trying to create a loop that prints the output in an array and not sure how to save/print as I want.
num=5;
for k=1:num
a=k^2;
num=num+1;
end
output=[a(1), a(2), a(3), a(4), a(5)]
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!