How can i find largest 8 bit number from these 08 bit numbers i m getting ?

조회 수: 2 (최근 30일)
diwa
diwa 2017년 12월 1일
댓글: diwa 2017년 12월 2일
a=imread('C:\Users\a.png');
disp(a);
for i=1:256
for j=1:256
b(i,j,1) = de2bi(a(i,j),8);
disp(b)
end
end

채택된 답변

dpb
dpb 2017년 12월 1일
That's a new one to me...but, it's not of a lot of use for the purpose you're asking about as it is still a vector representation of the binary value albeit numeric rather than character as does dec2bin. You still can't do comparisons or arithmetic or the like on the results other than on an element-by-element (bit-by-bit) basis.
To find the maximum or anything else numeric other than bit-wise operations on the elements as bit values, simply use the original array--
[maxa,idxmax]=max(a(:)); % find max, location of max overall in array
NB: the (:) to address the array a as a vector; the location will be the linear position in the array. If you need the location in the array itself, then
[imx,jmx]=ind2sub(size(a),idmax);
  댓글 수: 5
dpb
dpb 2017년 12월 2일
"compare between two or three 8bit numbers..."
Then construct an array dynamically...
[maxa,idxmax]=max([a,b,c]);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by