How to load txt to matlab which is got by the fortran.
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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})];
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fortran with MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!