MATLAB Answers

How to save output of double loop as a matrix?

4 views (last 30 days)
Noor Bano
Noor Bano on 19 Sep 2021
Commented: Star Strider on 20 Sep 2021
for i=1:m
for j=1:n
A=myfunction(...)
end
end
where the output A is the square matrix.
How to save output A for each iteration

Accepted Answer

Star Strider
Star Strider on 19 Sep 2021
Since ‘A’ is a matrix, save it as a cell array —
for i=1:m
for j=1:n
A{i,j} = myfunction(...)
end
end
.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!