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 comentario

Stephen23
Stephen23 el 25 de Jul. de 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:

Iniciar sesión para comentar.

Respuestas (2)

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

Categorías

Etiquetas

Preguntada:

el 25 de Jul. de 2018

Comentada:

el 27 de Jul. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by