Extract submatrix from matrix.
7 views (last 30 days)
Show older comments
Let's say that we have a matrix ( m x n ). This matrix contains values of 0 and 1. There is a "square shape" inside that matrix that is filled with 1. And another "shape" let's say filled with 1. How can i extract those "shapes" and create 2 separate matrices from them?
0 0 0 0 0 1 1 1
0 1 1 0 0 1 1 1
0 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0
Something like this . How can i create from this matrix only this matrix:
1 1
1 1
And this:
1 1 1
1 1 1
0 Comments
See Also
Categories
Find more on Matrix Indexing 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!