Borrar filtros
Borrar filtros

Counting number of rows in a field of structure

55 visualizaciones (últimos 30 días)
alfred
alfred el 6 de Jun. de 2017
Comentada: dpb el 9 de Jun. de 2017
Hi all!
I need to know how many rows are in a structure field.
The number of rows are not fixed. I try to use numel for counting the numbers inside any row but doesn't work.
I try too with size function but doesn't work either.
  • * Message error: too many input/output arguments.**
How can i solve this?
Thanks for all!

Respuestas (1)

dpb
dpb el 6 de Jun. de 2017
Well, that's an ambiguous question if ever were one...certainly for a given structure/field combination size works; we need to see an example of
  1. the structure in question
  2. what you tried
>> s.f1=rand(3); % a sample structure with field f1
>> nr=size(s.f1,1); % number of rows in field content
ans =
3
>>
  2 comentarios
alfred
alfred el 9 de Jun. de 2017
Thanks for your answer.
I solve the problem with other loop in other part of the program.
But i'm interestin in to know how can i do to an other way.
I attach an image about my structure.
Thanks in advance for your support.
dpb
dpb el 9 de Jun. de 2017
Nothing attached; what would be better instead would be a .mat file containing a (small) set of the struct and a description of what you're try to retrieve and what you tried...we can't do anything with an image.

Iniciar sesión para comentar.

Categorías

Más información sobre Structures 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