フィルターのクリア

file read & write to text file for long data

4 ビュー (過去 30 日間)
제 허
제 허 2021 年 9 月 25 日
回答済み: 제 허 2021 年 9 月 27 日
I want to write binary data to .txt format
clear all; close all
rng(1);
x = randi([0,1], 1,10000);
fileID = fopen('test_vector2.txt','w');
fprintf(fileID,'%d \n',x);
fclose(fileID);
when I open the .txt file in matlab, it is not problem. but when i open the file extenal of matlab, I cant understand contents of file.
in the case of small size x, there are not problem, but another case big size x, there are problem.
  1 件のコメント
Ive J
Ive J 2021 年 9 月 26 日
What do you mean by "when i open the file extenal of matlab, I cant understand contents of file"? If you open test_vector2.txt in any text editor, you can see the contents. Note that also it's not a binary file, it's a plain text file.
What do you wanna do and what's your problem exactly?

サインインしてコメントする。

回答 (1 件)

제 허
제 허 2021 年 9 月 27 日
when I open the file double click, I cant understand .txt file as above figure.
but when I open the file in matlab, I can understand and read this data.
I guess that data x is so long, then the file is broken. ??
thank you for your answer

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by