Import Mixed Data from Text Files

19 ビュー (過去 30 日間)
Rohola Hasanpour
Rohola Hasanpour 2017 年 8 月 28 日
編集済み: ES 2017 年 8 月 28 日
Hi everybody, How I can import such a mixed data from a text file and divide it to 4 columns without comma and parenthesis?
118529 (-2.108770e+06, 3.933470e+05, 2.268206e+05)
118530 (-1.931512e+06, 4.249201e+05, 4.509320e+05)
118531 ( 4.161104e+04,-2.671660e+05, 5.747989e+02)
118532 (-2.590310e+05, 1.361436e+05, 4.507392e+05)
118533 (-2.294893e+06,-5.320514e+04,-8.098187e+05)
118534 (-4.120486e+05,-1.244110e+05, 1.445418e+04)
118535 ( 2.865362e+05,-1.483941e+05, 5.440831e+04)
118536 (-1.341668e+06, 1.425650e+04,-2.907751e+05)

回答 (1 件)

ES
ES 2017 年 8 月 28 日
編集済み: ES 2017 年 8 月 28 日
fid = fopen('mydata.txt');
C = textscan(fid, '%d(%f,%f,%f)');
fclose(fid);

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by