Effacer les filtres
Effacer les filtres

read a file.dat from matlab

2 vues (au cours des 30 derniers jours)
Souhir FH
Souhir FH le 2 Mar 2016
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

Réponses (1)

Walter Roberson
Walter Roberson le 2 Mar 2016
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.)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by