MATLAB: Reading numerical data from text file

fopenread from text filesread numerical datatextscan

I have a large number of text files containing numerical data of the form:
-1.1389E+00 7.5269E-05 | -1.6667E-01 0.0000E+00
-8.6111E-01 2.1246E-04 | 1.6667E-01 0.0000E+00
-5.8333E-01 8.3611E-04 | 5.0000E-01 0.0000E+00
-3.0556E-01 1.5146E-03 | 8.3333E-01 0.0000E+00
-2.7778E-02 1.9345E-03 | 1.1667E+00 0.0000E+00
2.5000E-01 2.5737E-03 | 1.5000E+00 0.0000E+00
5.2778E-01 4.2668E-03 | 1.8333E+00 0.0000E+00
8.0556E-01 1.3023E-02 | 2.1667E+00 0.0000E+00
1.0833E+00 4.3410E-02 | 2.5000E+00 0.0000E+00
1.3611E+00 8.0197E-02 | 2.8333E+00 0.0000E+00
1.6389E+00 1.6765E-01 | 3.1667E+00 4.0626E-03
1.9167E+00 3.3707E-01 | 3.5000E+00 3.8941E-02
2.1944E+00 1.9501E-01 | 3.8333E+00 3.4817E-01
2.4722E+00 9.7508E-02 | 4.1667E+00 5.0355E-01
2.7500E+00 4.1161E-02 | 4.5000E+00 9.2447E-02
3.0278E+00 8.1076E-03 | 4.8333E+00 8.8021E-03
3.3056E+00 3.3931E-03 | 5.1667E+00 3.4740E-03
3.5833E+00 1.8372E-03 | 5.5000E+00 5.5974E-04
3.8611E+00 2.1554E-04 | 5.8333E+00 0.0000E+00
4.1389E+00 0.0000E+00 | 6.1667E+00 0.0000E+00
------------------------------------------------------
8.2128E+01 | 1.1521E+04
How can I load the numerical columns as a 2-column array (the '|' sign is just a separator).

Best Answer

I have no idea what you want to do.
You can read the entire file into your MATLAB workspace using load, readmatrix, dlmread, textscan, and probably others. Some of these (e.g. textscan) give you the ability to read some columns and not others.
As a rule, it is likely best to read the entire file, then select or calculate the result of that to get the two columns you want.