How do I find the submatrix of a matrix?
Show older comments
I'm new to Matlab so bear with me.
If I have a 2D matrix A and a submatrix B of A. How can I check if B is a submatrix of A?
I basically want to search for matrix B in A.
An example with code would be appreciated :)
Accepted Answer
More Answers (1)
[R,P] = ismember(B,A)
if R contains all ones then B is a submatrix of A and P contains the indices of A where B is located, ie A(P) = B
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!