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

3 ビュー (過去 30 日間)
yu
yu 2013 年 6 月 22 日
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

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 6 月 22 日
fid = fopen('YourFile.txt', 'r');
datacell = textscan(fid, '%f(%f,%f)');
fclose(fid);
data = [datacell{1}, complex(datacell{2},datacell{3})];
  1 件のコメント
yu
yu 2013 年 6 月 22 日
Thank you very much,it does help.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFortran with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by