필터 지우기
필터 지우기

Raise the zeros in the vector up

조회 수: 1 (최근 30일)
Eran Shvartzman
Eran Shvartzman 2017년 12월 15일
댓글: Eran Shvartzman 2017년 12월 16일
If I have a vector [5 8 0 7 9 0 3], how do I put it this way: [0 0 5 8 7 9 3] use only function if-else
thank you.

채택된 답변

KL
KL 2017년 12월 15일
Something like this,
v = [5 8 0 7 9 0 3]
ind = v==0;
v = [v(ind) v(~ind)]
  댓글 수: 1
Eran Shvartzman
Eran Shvartzman 2017년 12월 16일
Thanks! But if I want it to work for any vector / matrix?
For example: [5 8 0 7 9 0 3] ' it will not work

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by