Borrar filtros
Borrar filtros

Convert BIN to HEX

18 visualizaciones (últimos 30 días)
Matt
Matt el 18 de Oct. de 2015
Editada: Matt el 18 de Oct. de 2015
Hello guys,
I have a .BIN file that looks like this when opened in Matlab:
I would like to convert this to a HEX file with this kind of shape (this is from a HEX editor):
The 2 are not linked together, I just took portions of the file to show. How can I do such transformation so I can work with HEX data in Matlab?
Thanks!

Respuesta aceptada

James Tursa
James Tursa el 18 de Oct. de 2015
Editada: James Tursa el 18 de Oct. de 2015
doc fopen
doc fread
doc dec2hex
  1 comentario
Matt
Matt el 18 de Oct. de 2015
Editada: Matt el 18 de Oct. de 2015
Thanks for your answer! So I wrote the following script, but I don't get the same HEX values as my HEX editor. I don't see what's wrong tho:
fopen('file.bin')
fread(ans)
dec2hex(ans)
code=reshape(ans,32,[])'
This gives me a matrix with the correct number of rows and columns but the values don't match!
EDIT: seems like the issue is during the reshaping process. Will investigate.
EDIT 2: works now, thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Text Data Preparation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by