Borrar filtros
Borrar filtros

Probe data from a field in a structure

1 visualización (últimos 30 días)
Joseph Rubin
Joseph Rubin el 4 de Jun. de 2020
Respondida: darova el 13 de Jun. de 2020
Hello,
I have a structure that contains 6 fields. One of these fields is called 'frames'. 'frames' contains 3500 one dimensional arrays. I want to know if any one of these arrays contains the number 1 or the number 1092. How would I determine this?
Thanks so much,
Joseph Rubin
  2 comentarios
Stephen23
Stephen23 el 4 de Jun. de 2020
What size is the structure?
Joseph Rubin
Joseph Rubin el 4 de Jun. de 2020
This is a 1x3412 struct with 6 fields.

Iniciar sesión para comentar.

Respuestas (2)

madhan ravi
madhan ravi el 4 de Jun. de 2020
Counts = nnz(ismember(STRUCt.frames,[1,1092]))
  1 comentario
Joseph Rubin
Joseph Rubin el 4 de Jun. de 2020
This does not work. The name of the structure is spotEvents1. I type
Counts = nnz(ismember(spotEvents1.frames,[1,1092]))
and I get the error:
"Error using ismember
Too many input arguments."
Please let me know if you know what to do.
Thanks!

Iniciar sesión para comentar.


darova
darova el 13 de Jun. de 2020
try this
n = numel(sportEvents1);
ind = false(n,1);
for i = 1:numel(sportEvents1)
if any( ismember(sportEvents1(i).frames,[1 1092]) )
ind(i) = true;
end
end

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by