how to write a matlab code to convert hexformat into decimal format of a colour image.The image resolution is 320X430.Please help me....

Thanks

5 Comments

What does this have to do with an image? How is your number in either format? Numbers are all in binary, unless you print them out as a character string to a file or the command window or somehow convert them to a string in another way. For example, 10 in decimal is A in hex but, no matter how you display it (as decimal or hex), in the computer it's 1010 (binary). Please give an example.
Actually i am using FPGA kit.Using this i have displayed a colour image,and pixel values are shown in the moinitor in the form of hex format.Nw i want to convert this hex format into decimal format.For eg: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOOOOOOO EEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000011FFFAAA11111111FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAAAAAAAAAAAAAAAAAAAAAAAAAAA00000000000000000000000000000000. Like that the values are shown.Nw i want to convert this into decimal format...............
I don't know what that kit is. Do you have the numbers in a variable? If so, tell us what
whos yourVariableName
reports back in the command window. And tell us what
sprintf('%d ', yourVariableName);
does.
FFFFFFA111
AAAAAAFFFF
FF0000AAAA
Jst take two values at a time from first row and then next two values and then next two vales.Now cnvert all these vales(2 values each at a time) into decimal format.I think now you got it.........
thanks
But you didn't do what I asked. Are those letters in a string variable? Can you do "whos" on it?

Sign in to comment.

 Accepted Answer

Assuming the hex numbers are in a 1xN char (test in this example):
Output will be Mx1 double array (ans in this example)
test = '0123456789ABCDEF';
ans = hex2dec(reshape(test, 2, numel(test)/2)');

3 Comments

sir if i will take test='0123456789ABCDE' Then it gives error....why?
sir,suppose A=['ff','ff','ff';'ab','fe','ba';'12','45','ab'] then how can i convert this matrix to decimal format.

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Asked:

on 6 Sep 2012

Community Treasure Hunt

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

Start Hunting!