if statement on vector to replace values
조회 수: 8 (최근 30일)
이전 댓글 표시
Hi all,
So i'd like to change a Matrix ((86400x1 double) or vector) which contains 1 colum and 86400 rows with an if statement.
My idea is to check every value if it's smaller than 0, and if so it should be replaced by Zero.
Would be great if someone could help me.
Thanks in advance
Bene
댓글 수: 0
채택된 답변
Alan Stevens
2020년 5월 29일
편집: Alan Stevens
2020년 5월 29일
If M is the vector try:
ix = (M<0); M(ix) = 0;
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!