How to load txt to matlab which is got by the fortran.

1 view (last 30 days)
my txt format is:
0.987548828125000 (15.0987939173195,0.000000000000000E+000)
1.97509765625000 (5.36979083395557,0.000000000000000E+000)
2.96264648437500 (2.49964765804540,0.000000000000000E+000)
3.95019531250000 (1.43875757499693,0.000000000000000E+000)
The first column is float and second is the complex.
How to load this txt to matlab
Thanks

Answers (1)

Walter Roberson
Walter Roberson on 22 Jun 2013
fid = fopen('YourFile.txt', 'r');
datacell = textscan(fid, '%f(%f,%f)');
fclose(fid);
data = [datacell{1}, complex(datacell{2},datacell{3})];

Categories

Find more on Fortran with MATLAB 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!