필터 지우기
필터 지우기

How can I filter the negative value?

조회 수: 3 (최근 30일)
sewook
sewook 2012년 4월 20일
Hello, I am a beginner at MATLAB and English, but I would like to use this tool, please give a answer.
the matrix A like below:
A = [100 -20 50 -3]
I would like to convert like below:
B = [100 0 50 0] %make 0 if a value is negative.
or
C = [10000 -20 5000 -3] % multiply 100 if value is positive.
how can I do this convertion?

채택된 답변

Rick Rosson
Rick Rosson 2012년 4월 20일
B = A.*(A>0);
C = A.*(A>0)*100 + A.*(A<0);
  댓글 수: 1
sewook
sewook 2012년 4월 20일
Thank you~ ^^;
it is very simple and clear~~

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

추가 답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by