delete null in matrix

21 次查看(过去 30 天)
Tomas
Tomas 2013-12-14
评论: Tomas 2013-12-14
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

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2013-12-14
编辑:Azzi Abdelmalek 2013-12-14
M=[ 0 0 0 ; 7.9286 10.1000 14.3714]
M=M(all(M,2),:)
  3 个评论
Tomas
Tomas 2013-12-14
Ok, Thanks

请先登录,再进行评论。

更多回答(1 个)

sixwwwwww
sixwwwwww 2013-12-14
do it like this:
M=[ 0 0 0 7.9286 10.1000 14.3714];
M = M(M ~= 0)
  5 个评论
sixwwwwww
sixwwwwww 2013-12-14
do you want to convert them to a column vector of non-zero values?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by