As input to a function, I am getting an array of target elements, T, and an array of structs S where each one has a .elems field, which is a list of integers (elements).
I’m sure there’s a simple way to do this in Matlab. How do I get the indices i of all structs where a specific element t of T is in S(i).elems contains t?
So I think you’ll need to do this with an arrayfun. I did:
any(ismember(T, S(i)elems))tests is any of the things in T are in S(i).elems. Thearrayfunrepeats this for each struct in S.findextracts indices from the logical array that is returned by the arrayfun.