17 views (last 30 days)

i have a 8x6 logical array

result1 =

8×6 logical array

1 0 0 0 0 0

0 0 0 1 0 0

0 0 0 0 1 0

0 0 0 0 0 0

0 1 0 0 0 0

0 0 1 0 0 0

0 0 0 0 0 1

0 0 0 0 0 0

how to use this logical array to extract the values in two matrix assosiated with logical ones

Jon
on 1 Aug 2019

It isn't quite clear the specifics of what you want to retrieve but for example if you wanted to get the row in frame 1 that matches row 2 in frame 2 you could use

row = row_frame1_adata(result1(:,2),:)

Jon
on 2 Aug 2019

Jon
on 2 Aug 2019

Your application is quite complicated and probably is not a good place to start learning how to code. I would suggest that if you have not done so already you should first complete the free MATLAB On Ramp training,

Make sure you work your way all the way through this and don't skip any steps.

After you complete the training and come back to your problem I think you will find you will be able to code a solution.

Sign in to comment.

Jackson Burns
on 1 Aug 2019

row_frame_data(result1)

Where row_frame_data is the 8*6 atrix of results and result1 is the logical matrix of the values you want.

Mark Hayworth
on 1 Aug 2019

Jackson Burns
on 1 Aug 2019

You will need to adjust the dimensions of your logical array to match the data.

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 8 Comments

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730673

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730673

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730678

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730678

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730681

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730681

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730683

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730683

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730688

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730688

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730696

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730696

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730729

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730729

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730734

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/474434-how-to-use-logic-array#comment_730734

Sign in to comment.