Probe data from a field in a structure

1 次查看(过去 30 天)
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 个)

madhan ravi
madhan ravi 2020-6-4
Counts = nnz(ismember(STRUCt.frames,[1,1092]))
  1 个评论
Joseph Rubin
Joseph Rubin 2020-6-4
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!

请先登录,再进行评论。


darova
darova 2020-6-13
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

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by