delete null in matrix

조회 수: 25 (최근 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
Azzi Abdelmalek
Azzi Abdelmalek 2013년 12월 14일
Still works
M=M(all(M,2),:)
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?
Tomas
Tomas 2013년 12월 14일
yes

댓글을 달려면 로그인하십시오.

카테고리

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