Also, I should have noted one of the issues is one column has a '+e' format for the exponential, which I believe is causing some issues, but I don't know how to solve this and it is so long (hundreds?) it is impractical to manually change it
How to import text file data (with exponential numbers) into Matlab for graphing and signal processing?
8 views (last 30 days)
Show older comments
Hello,
I need to import data from a text file with a format something like:
1.000e-1 4.336e-6 1.346e-6 3.200e-6 1.574e-6 1.194e-6 2.026e-6 1.850e-6 1.477e-6
2.000e-1 3.705e-6 1.028e-6 2.059e-6 1.092e-6 1.025e-6 1.547e-6 1.456e-6 1.257e-6
3.000e-1 3.341e-6 8.228e-7 1.528e-6 8.319e-7 8.841e-7 1.220e-6 1.199e-6 1.099e-6
4.000e-1 3.083e-6 6.876e-7 1.239e-6 6.794e-7 7.743e-7 9.999e-7 1.025e-6 9.833e-7
5.000e-1 2.882e-6 5.936e-7 1.062e-6 5.814e-7 6.880e-7 8.467e-7 9.004e-7 8.952e-7
6.000e-1 2.719e-6 5.250e-7 9.402e-7 5.137e-7 6.195e-7 7.368e-7 8.075e-7 8.256e-7
7.000e-1 2.583e-6 4.734e-7 8.529e-7 4.638e-7 5.633e-7 6.546e-7 7.359e-7 7.689e-7
8.000e-1 2.467e-6 4.334e-7 7.859e-7 4.260e-7 5.175e-7 5.926e-7 6.790e-7 7.210e-7
9.000e-1 2.369e-6 4.013e-7 7.334e-7 3.963e-7 4.789e-7 5.431e-7 6.320e-7 6.809e-7
Basically, I am not sure how it will show up on the posting, but there are 9 very long columns, each representing a separate data set. I Just need to extract the data from each column into a vector or matrix I can use for graphing etc. I am having a lot of trouble with various ways to import (textscan, using .dat formats, etc) especially with holding the exponentials. What's the best way to do this? Thanks so much!
Answers (1)
Azzi Abdelmalek
on 5 Mar 2013
Edited: Azzi Abdelmalek
on 5 Mar 2013
A=dlmread('yourfile.dat')
2 Comments
See Also
Categories
Find more on Text Data Preparation 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!