Thresholding a value in matrix
조회 수: 16 (최근 30일)
이전 댓글 표시
I had been given a 8x8 matrix. How can I theshold a value in the matrix?

for example 100 or 255. Thank you.
댓글 수: 0
채택된 답변
Rik
2020년 11월 19일
You can use the comparator operators to apply a threshold:
data=randi(200,8,8);
L= data<100; %L is true for all positions with a value below 100
data2=data;%make a copy
data2(L)=200 %edit only some values
댓글 수: 3
Rik
2022년 11월 17일
@Daniel Arturo That is how I generated an array with numbers of approximately the same data range as shown in the question. Because it was posted as an image I couldn't use the actual data without copying them all by hand. This command generates an 8x8 grid with random integers from 1 to 200.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!