How to save structue generated in a loop?

I need to save "St" that generated with in a loop, as St1, St2, St3... "St" looks like below. Also I need to load those St1, St2, St3.. in a program.
St =
R: [5x5 double]
df: 7
normr: 0.0799

1 commentaire

Stephen23
Stephen23 le 25 Juil 2018
"I need to save "St" that generated with in a loop, as St1, St2, St3..."
That is exactly what you should not do. Read this to know why:

Connectez-vous pour commenter.

Réponses (2)

KSSV
KSSV le 25 Juil 2018
T = struct ;
for i = 1:3
T(i).st = rand(3,1) ;
end
Stephen23
Stephen23 le 25 Juil 2018
Just use indexing:
for k = ...
S(k) = st
end
and you will get all of your data in one non-scalar structure.

Catégories

Question posée :

le 25 Juil 2018

Commenté :

le 27 Juil 2018

Community Treasure Hunt

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

Start Hunting!

Translated by