Find the inear indices of a specific value in a 3d matrix using the positions of a 2d matrix
1 view (last 30 days)
Show older comments
If I have one 3d matrix A, and one 2d matrix B, how can I find the linear indices of a specific value of A in all its pages, given the position of another value of B?
For instance, if A is a 3x4x4 matrix like:
A(:,:,1)=
0 1 2 0
1 1 0 2
2 2 0 1
A(:,:,2)=
2 0 0 0
0 1 0 2
2 0 1 1
and B is a 3x4 one:
1 1 1 1
2 2 2 2
3 3 3 3
I would like to find all the linear indices of A == 2 when B == 1, such as:
LinInd= [7; 13]
How can I do that?
0 Comments
Accepted Answer
More Answers (1)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!