Import Mixed Data from Text Files

15 views (last 30 days)
Rohola Hasanpour
Rohola Hasanpour on 28 Aug 2017
Edited: ES on 28 Aug 2017
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)

Answers (1)

ES
ES on 28 Aug 2017
Edited: ES on 28 Aug 2017
fid = fopen('mydata.txt');
C = textscan(fid, '%d(%f,%f,%f)');
fclose(fid);

Categories

Find more on Large Files and Big Data in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!