Read text file and store in .mat file
2 ビュー (過去 30 日間)
古いコメントを表示
I have a text file with these values:
d030bcb1
6142d6ad
619b8312
618803cb
61866781
619c04c5
61c420b2
61ba1feb
61bec5b3
6221fe09
I want to read this text file and store in a .mat file.
thanks in advance
0 件のコメント
採用された回答
Azzi Abdelmalek
2013 年 9 月 7 日
編集済み: Azzi Abdelmalek
2013 年 9 月 7 日
fid = fopen('file1.txt');
A= textscan(fid,'%s');
fclose(fid);
celldisp(A)
save file2 A
0 件のコメント
その他の回答 (2 件)
Walter Roberson
2013 年 9 月 7 日
data = regexp( fileread('file1.txt'), '\n', 'split' );
save file2 data
0 件のコメント
Razvan
2013 年 9 月 7 日
filename = 'example.txt';
fileID = fopen(filename,'r');
data = textscan(fileID, '%s\n');
data = data{1};
fclose(fileID);
save('example.mat', 'data')
参考
カテゴリ
Help Center および File Exchange で Text Data Preparation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!