Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Remove repeated row in a matrix (specially zero's repeated row)

1 visualizzazione (ultimi 30 giorni)
a =
1 4 6
0 0 0
6 7 3
0 0 0
3 1 2
0 0 0
0 0 0
Remove the repeated zero row.
I want this output
b=
1 4 6
0 0 0
6 7 3
3 1 2
  1 Commento
Anusha
Anusha il 5 Nov 2013
Modificato: Anusha il 5 Nov 2013
ADD part
a=
[1 4 6
0 0 0
6 7 3
0 0 0
3 1 2
0 0 0
0 0 0
1 0 0]
b=
1 4 6
0 0 0
6 7 3
3 1 2
1 0 0

Risposte (1)

Azzi Abdelmalek
Azzi Abdelmalek il 4 Nov 2013
Modificato: Azzi Abdelmalek il 5 Nov 2013
EDIT
a = [1 4 6
0 0 0
6 7 3
0 0 0
3 1 2
0 0 0
0 0 0]
idx=find(~any(a,2))
a(idx(2:end),:)=[]
  4 Commenti
Azzi Abdelmalek
Azzi Abdelmalek il 5 Nov 2013
Modificato: Azzi Abdelmalek il 5 Nov 2013
Ok, try this
idx=find(~any(a,2))
a(idx(2:end),:)=[]

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by