1

I have an array of structures, each structure with fields 'input' and 'output'. Input values are binary arrays, output values are integers. Let's say I have a specific binary array, for example A = [0 1 1 0 1 0]. How do I find the element in my array that has value in input field equal to A?

1 Answer 1

8

You could use ARRAYFUN

logicalIndexOfElement = arrayfun(@(x)all(x.input==A),yourStructure)

Call FIND on logicalIndexOfElement to get the linear indices of the elements in yourStructure.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.