フィルターのクリア

How can I import a structured binary file into matlab

1 回表示 (過去 30 日間)
Murat Melek
Murat Melek 2014 年 1 月 24 日
回答済み: Walter Roberson 2014 年 1 月 24 日
I have a binary file that is structured as: a control record showing the number of elements: integer*4 followed by records for each element structured as: integer*4 , character*8 and character*40. how can i convert the element records into an array?
Thanks

回答 (2 件)

Walter Roberson
Walter Roberson 2014 年 1 月 24 日

Iain
Iain 2014 年 1 月 24 日
Not sure about quick n easy ways of doing it, but:
fid = fopen(filename,'r');
elements = fread(fid,1,'*uint32');
for i = 1:elements
read_out{1,i} = fread(fid,1,'*uint32');
read_out{2,i} = char(fread(fid,8,'*uint8')');
read_out{3,i} = char(fread(fid,40,'*uint8')');
end

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by