read a file.dat from matlab

Hello, I would like to read a file.dat wich contains pixels, this file is generated from code composer studio , how can i display this image in matlab? thanks

Respuestas (1)

Walter Roberson
Walter Roberson el 2 de Mzo. de 2016

0 votos

fid = fopen('TheFile.dat', 'r');
pixels = fread(fid, inf);
fclose(fid);
Image_Array = reshape(pixels, ... some appropriate dimensions ... );
image(Image_Array);
You need to know the shape (rows, columns, number of color channels), or those have to be stored in the file. Watch out for whether the data was stored "across" (fairly common) or "down" (what MATLAB expects.)

Categorías

Más información sobre Data Import and Analysis en Centro de ayuda y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 2 de Mzo. de 2016

Respondida:

el 2 de Mzo. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by