How to read a structure array

3 visualizaciones (últimos 30 días)
Ocram
Ocram el 29 de Mzo. de 2012
Hi everybody, I'm trying to insert a structure array inside a for loop in order to allow the reading of each fiel automatically, by linking an index to the structure field. Is this possible or I can only access it by indicating the name of the field?
Thank, M
  1 comentario
Jan
Jan el 29 de Mzo. de 2012
It is always a good idea to post the currently existing code.

Iniciar sesión para comentar.

Respuestas (1)

Andrei Bobrov
Andrei Bobrov el 29 de Mzo. de 2012
pg
Mstruct = struct('a','gfjgfjf','b',[4 5 6],'c',{{7 8 9}})
nfield = fieldnames(Mstruct)
for j1 = 1:numel(nfield),disp(Mstruct.(nfield{j1}));end

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by