fwrite and fread: different dimensions for the same matrix

2 ビュー (過去 30 日間)
Simon Lind
Simon Lind 2015 年 5 月 20 日
コメント済み: Simon Lind 2015 年 5 月 20 日
Please
I’m trying to save a 2160x4320 matrix as
>> fid = fopen([Path filename '.bin'],'wb');
>> fwrite(fid,filename,'uint8');
>> fclose(fid);
% with Path and filename = char
But it only saves a 12x1 vector, where am I wrong?
Thank you in advance

採用された回答

Image Analyst
Image Analyst 2015 年 5 月 20 日
Because you're writing out the filename string , not the matrix.
Try
fwrite(fid, yourMatrix,'uint8');
By the way, since this appears to be a uint8 image, why not use imwrite() and use a standard image file format such as PNG? Why use .bin and fwrite()?

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by