Find runs of repeated ones of any length and put into a cell array to compare indices

2 visualizaciones (últimos 30 días)
Hello,
I have two logical arrays, A & B, of size 370x23. They are the ouputs from two different functions performed on the same matrix, C.
A contains long runs of 1s while B contains 1-5 (approx) 1s in a row at a time.
I want to find strings of 1s (or rund of consecutive 1s) of any length in A to check if their indices overlap at all with B. If the strings in A contain B, then I want to keep the entire string of 1s in A. If they don't, then the whole string goes to 0s.
Another way to ask this would be how to group strings of 1s and then use their indices to check overlap with another set of indices.
Thanks youse.

Respuestas (1)

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi el 20 de Abr. de 2020
Hi,
You could use the 'find' function to find the indices at which the 1's are present and compare those indices.
For more information on how to use find function refer to the following link
  4 comentarios
Image Analyst
Image Analyst el 20 de Abr. de 2020
Teddy, this is trivial with regionprops() in the Image Processing Toolbox.
Teddy Fisher
Teddy Fisher el 21 de Abr. de 2020
I looked up the documentation for regionprops and I don't see how that would be done. Any advice?

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos


Versión

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by