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
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
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.
Play games and win prizes!Learn more