logical on structure data
显示 更早的评论
I need to perform a logical operation on array data in a structure, I'm close but cant quite find the neat & efficient solution.
The structure is:
s = struct('binarydata',zeros(vidHeight,vidWidth), 'otherStuff', other);
%then populate s in a loop
...
I then want to perform logical operation on the data in parts of s, eg elementwise and across a range of arrays in s, like this:
result = and ( s(1).binarydata, s(2).binarydata,s(3).binarydata, ...);
but I'd like to be able to do dynamically in a loop, eg:
result = and ( s(i:i+60).binarydata);
which doesn't work as s(i:i+60).binarydata only returns the 60th element. or
result = and ( [s(i:i+60).binarydata]);
which doesn't work either because it concatenates the arrays.
I'm close but can't quite get the syntax right.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Structures 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!