Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How do i change values in an array of numbers based on their current value?
조회 수: 4 (최근 30일)
이전 댓글 표시
Lets assume we have an array and some variables.
I=[32 12; 44 9]
T=30
I_T= I >30
We need to change the values of the elements of the array accordingly to T. For example, the first value is 32 which exceeds T. The value should be changed to 255. The second value is 12 which does not exceed T. Its value should be changed to 0. We need a function that does that for any given array length in the command window. Thanks in advance.
댓글 수: 0
답변 (1개)
the cyclist
2016년 2월 9일
편집: the cyclist
2016년 2월 9일
loIdx = (I <= T);
hiIdx = (I > T);
I(loIdx) = 0;
I(hiIdx) = 255;
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!