I am having problem using hex2dec. It shows an error when it is used.

7 visualizaciones (últimos 30 días)
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

Respuestas (1)

the cyclist
the cyclist el 24 de Mzo. de 2013
Editada: the cyclist el 24 de Mzo. de 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 comentarios
Walter Roberson
Walter Roberson el 24 de Mzo. de 2013
I think de_hex4 is a variable, but I do not know what was assigned to it.
the cyclist
the cyclist el 24 de Mzo. de 2013
You are right. I wrote function instead of variable. I have edited.

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by