Read text file with string
古いコメントを表示
Hi all,
I have to read the file (inserted in attachment) and only need the numeric portion as a matrix(array). The extension of file is .TXK .
Thanks in advance
採用された回答
その他の回答 (1 件)
Guillaume
2020 年 3 月 4 日
Should work in R2016a:
filename = 'My2.TXK'; %using full path would be better
[fid, errmsg] = fopen(filename, 'rt');
assert(fid > 0, 'Failed to open "%s" due to error: %s', filename, errmsg);
data = cell2mat(textscan(fid, '%f%f%f', 'Delimiter', {'\t', ' '}, 'MultipleDelimsAsOne', true, 'HeaderLines', 1));
fclose(fid);
カテゴリ
ヘルプ センター および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!