필터 지우기
필터 지우기

How can I default an array to show either 0's or 1's?

조회 수: 1 (최근 30일)
onamaewa
onamaewa 2019년 3월 4일
답변: Guillaume 2019년 3월 4일
I have an array that is defined by:
pict(i, j) = pict(i, j) + (sum1^2 - sum2)/32;
The array is a 41 x 41 double, and yields the result:
untitled_1.jpg
I'm plotting this figure using:
image(Rx, (Ry-40), pict, 'CDataMapping', 'scaled')
The area (in yellow) at -11 on the y-axis is my maximum point in the image. Is there a way for me to manipulate my array to make a range of maximum values 1 and everything else 0?
  댓글 수: 2
Guillaume
Guillaume 2019년 3월 4일
What is "a range of maximum values" ?
onamaewa
onamaewa 2019년 3월 4일
The values in the image go from 0 to 17, so a range a maximum values would be, for example, 16.5 to 17.

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

채택된 답변

Guillaume
Guillaume 2019년 3월 4일
If I understood correctly,
wantedarray = pict >= 16.5; %everything above 16.5 becomes 1, everything else 0
%or
wantedarray = double(pict >= 16.5); %if an array of double instead of logical is required

추가 답변 (1개)

Steven Lord
Steven Lord 2019년 3월 4일
If you're using release R2018a or later use the normalize function to normalize your data.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by