How to name structured variable with number that correspond to number of itteration?

1 visualización (últimos 30 días)
How do I name structured variable with number that correspond to itteration in a loop? For example
for l=1:5
for i=...
for j=...
S.l{i,j}=...
end
end
end
I want to have structured variable S with files 1,2,3,4,5 and inside each file to have cell. thanks!!

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 3 de Jun. de 2013
Editada: Azzi Abdelmalek el 3 de Jun. de 2013
You can not use a number as a field, try this
for l=1:5
for i=1:3
for j=1:4
S.(sprintf('f%d',l)){i,j}=rand
end
end
end

Más respuestas (0)

Categorías

Más información sobre Assembly en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by