Borrar filtros
Borrar filtros

find first value and repalce values following it

1 visualización (últimos 30 días)
Dam
Dam el 5 de Mayo de 2015
Comentada: Dam el 5 de Mayo de 2015
Good morning, I have an the following matrix 6*3:
1 1 1
1 1 1
0 1 1
1 1 0
1 1 1
0 0 1
I want to keep the first zero of each colomne and to replace the values that follow it by zeros to get:
1 1 1
1 1 1
0 1 1
0 1 0
0 1 0
0 0 0
Thank you for help bests

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 5 de Mayo de 2015
A = [1 1 1
1 1 1
0 1 1
1 1 0
1 1 1
0 0 1];
cumprod(A)

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by