How can I import a file.txt and extract data?
1 回表示 (過去 30 日間)
古いコメントを表示
Roberto Palmeggiani
2021 年 11 月 25 日
コメント済み: Roberto Palmeggiani
2021 年 11 月 27 日
I want to create a function.
The function has to read the file and create a matrix: the first column must contain the first column of numbers (the numbers after HIP). In the second and third coulmn i need the numbers into the square parenthesis (they are coordinates).
How can I do?
0 件のコメント
採用された回答
Stephen23
2021 年 11 月 25 日
opt = {'CollectOutput',true};
[fid,msg] = fopen('prova2.txt');
assert(fid>=3,'%s',msg)
hdr = fgetl(fid);
out = textscan(fid,'HIP%d[%d,%d]%[^\n\r]',opt{:});
fclose(fid);
out{:}
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Introduction to Installation and Licensing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!