Wrting binary data to text file
2 ビュー (過去 30 日間)
古いコメントを表示
Hey everybody, I have some binary information, like a=[11110000 00001111 00000000 11111111], I want to write them to a text file. i tried with fprintf and fwrite but i couldn't! anybody has such a experience? Thanks a lot in advance. best.
3 件のコメント
回答 (2 件)
Huang Andong
2014 年 1 月 9 日
a=[11110000; 00001111; 00000000; 11111111]; dlmwrite('C:\Users\dell\Desktop\a.txt',a);
Walter Roberson
2014 年 1 月 9 日
t = cellstr(dec2bin(a, 8));
fid = fopen('a.txt', 'wt');
fprintf(fid, '%s\n', t{:});
fclose(fid);
3 件のコメント
Walter Roberson
2014 年 1 月 14 日
That is not going to work.
>> ['11111111' , '00000000' , '10101010']
ans =
111111110000000010101010
Remember, [] is concatenation for strings. {} is for string arrays.
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!