How do I find the submatrix of a matrix?
Mostrar comentarios más antiguos
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 :)
Respuesta aceptada
Más respuestas (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
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!