Data saving for a loop
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (1)
William
il 23 Gen 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
Categorie
Scopri di più su MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!