Data saving for a loop
Show older comments
I have a code like this:
for i=1:n
%calculuse
for j=1:n
%calculus
for k=1:n
%calculus
Save results in a matrix
end
end
end
I want to save the matrix inside a bigger matrix with matrix elements for each loop inside dhe interioe loop (k=1:k)
Thank you in advance
Accepted Answer
More Answers (1)
William
on 23 Jan 2021
a = zeros(n,n,n)
for i=1:n
%calculus
for j=1:n
%calculus
for k=1:n
%calculus
a(i,j,k) = result(k)
end
end
end
Categories
Find more on MATLAB 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!