Check if sub-block in matrix meets a condition?
Ältere Kommentare anzeigen
I have a 7x10 matrix of integer values (see attached .mat file). I want to check if a block inside the matrix (lets say 2x2) meets a condition. For example: lets say I want to see if any 2x2 block in the attached matrix all have values of 2. If there is such a 2x2 block within the matrix then return a value of 1 (true), if not return value of 0 (false). In the matrix attached, there is a 2x2 block of 2s so the output of what I am looking for in this example would be 1 (true). I would also like to generalize this for any size block.
Akzeptierte Antwort
Weitere Antworten (1)
Andrew Poissant
am 14 Sep. 2018
Bearbeitet: Andrew Poissant
am 14 Sep. 2018
0 Stimmen
2 Kommentare
Adam Danz
am 14 Sep. 2018
How are you using the outputs of intersect() to determine if your submatrix is within the main matrix?
Andrew Poissant
am 14 Sep. 2018
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!