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
回答(1 个)
Walter Roberson
2016-3-2
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.)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!