Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am unable to implement the step"Convert binary image to decimal with 3*3 block size

What I have tried:

function dec = bin2dec2(~)
binstring = [];
bin=input('enter binary number:','s');
if length(bin) > 1
     for i = 1:length(bin)
          tempstring = num2str(bin(i));
          binstring = [binstring,tempstring];
     end
else
     binstring=num2str(bin);
end
for i = 1:length(binstring);
     value(i)=str2double(binstring(i)) ...
     *(2^(length(binstring)-i));
end
dec=sum(value);
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900