Import Mixed Data from Text Files

20 次查看(过去 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 CenterFile Exchange 中查找有关 Large 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