Info
This question is closed. Reopen it to edit or answer.
Remove repeated row in a matrix (specially zero's repeated row)
1 view (last 30 days)
Show older comments
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
Answers (1)
Azzi Abdelmalek
on 4 Nov 2013
Edited: Azzi Abdelmalek
on 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 Comments
Azzi Abdelmalek
on 5 Nov 2013
Edited: Azzi Abdelmalek
on 5 Nov 2013
Ok, try this
idx=find(~any(a,2))
a(idx(2:end),:)=[]
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!