How to extract specific parts of a matrix
Show older comments
In a 512 x 512 matrix where each cell has a number between 0 and 1000, a large part of the cells in this matrix, for example, contains the value 98 (on the left) and on the other side, a large number of cells contain, for example, the value 900.
In the case of when there is only one matrix, it is easy to determine what numbers the matrix contains on both sides.
But in other matrices these numbers are different
I'm looking for a way to automatically specify these numbers on both sides of a matrix
Thank you for your help
Accepted Answer
More Answers (1)
Sulaymon Eshkabilov
on 26 Mar 2021
0 votes
Logical indexing would be an easy and fast solution.
3 Comments
Chad Greene
on 26 Mar 2021
Can you explain that?
Sulaymon Eshkabilov
on 26 Mar 2021
A = [1, 2, 3; 5 4 4; 6 4 4]; B = (A==4).*A
By this way, you'll get only values which are equal to 4 and the rest is "0".
Good luck.
lech king
on 27 Mar 2021
Categories
Find more on Creating and Concatenating Matrices 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!

