Extend / replicate a value by column when found in array
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
cedric W
el 6 de Sept. de 2018
Say I have a matrix 5x5 with binary entries 0 and 1
A=[1 1 1 1 1;1 0 1 1 1;1 0 1 0 0;0 1 1 0 1;1 1 1 0 0]
I'd like to have as a result, a matrix where when the array is parsed by column, if 0 is found, then all rows indexed after are 0:
B=[1 1 1 1 1;1 0 1 1 1;1 0 1 0 0;0 0 1 0 0;0 0 1 0 0]
Any clue for a fast computing solution ? FYI every column is independent.
2 comentarios
KALYAN ACHARJYA
el 6 de Sept. de 2018
Editada: KALYAN ACHARJYA
el 6 de Sept. de 2018
@cedric The question is not clear for me
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Multidimensional Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!