I am having problem using hex2dec. It shows an error when it is used.
4 views (last 30 days)
Show older comments
I am using MATLAB R2009. And I have problem using hex2dec. I am permutating a the row element after using dec2hex, and then using hex2dec. and it show the following error message.
Error using ==> hex2dec at 38
Input string found with characters other than 0-9, a-f, or A-F.
Error in ==> crypt_d at 62
td8=hex2dec(td8);
when i check the td8 variable the element which has zeros has been replaced by empty space as in
td8
td8 =
0C F 9
the space between C and F and F and 9 is supposed to be zeros. Can anyone please tell how to overcome these problem.
this is the part of the code where error is occurring
for i=1:si
td8=de_hex4(i,:);
td8=hex2dec(td8);
decr4=[decr4 ; td8-ad4];
end
0 Comments
Answers (1)
the cyclist
on 24 Mar 2013
Edited: the cyclist
on 24 Mar 2013
I am not sure where you got the variable de_hex4, but if you are confident that all you need to do is replace the spaces with zeros, then you can do that with the regexprep function:
td8 = regexprep(td8,' ','0');
before you then send it to hex2dec.
2 Comments
Walter Roberson
on 24 Mar 2013
I think de_hex4 is a variable, but I do not know what was assigned to it.
See Also
Categories
Find more on Digital Input and Output in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!