logical on structure data
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!