copying values using if statements

I am trying to write an if statement for a give matrix.
I have a matrix that is 54,1, with given values.
What I want it to do is that if the value is greater that 0, to make it equal to that value in the given matrix, and if the value is less than 0, to make it equal to 0.

답변 (1개)

Honglei Chen
Honglei Chen 2012년 12월 4일
편집: Honglei Chen 2012년 12월 4일

0 개 추천

say x is your matrix
x = randn(54,1);
x(x<0)= 0

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2012년 12월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by