delete null in matrix

63 views (last 30 days)
Tomas
Tomas on 14 Dec 2013
Commented: Tomas on 14 Dec 2013
I have matrix M=[ 0 0 0 7.9286 10.1000 14.3714]
I want to delete null in matrix.
I want matrix M=[7.9286 10.1000 14.3714]
Thanks

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 14 Dec 2013
Edited: Azzi Abdelmalek on 14 Dec 2013
M=[ 0 0 0 ; 7.9286 10.1000 14.3714]
M=M(all(M,2),:)
  3 Comments
Tomas
Tomas on 14 Dec 2013
Ok, Thanks

Sign in to comment.

More Answers (1)

sixwwwwww
sixwwwwww on 14 Dec 2013
do it like this:
M=[ 0 0 0 7.9286 10.1000 14.3714];
M = M(M ~= 0)
  5 Comments
Tomas
Tomas on 14 Dec 2013
yes

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by