I have a text file called epsi_20_20. In this file there is a large table with data. I would like to be able to create in MATLAB a matrix containing only the values of the last six columns. How can I do it? I tried with load but it does not seem to work.
##ASTER 13.06.00 CONCEPT table2 CALCULE LE 02/12/2019 A 10:08:31 DE TYPE
#TABLE_SDASTER
INTITULE NOEUD RESU NOM_CHAM NUME_ORDRE INST ABSC_CURV COOR_X COOR_Y COOR_Z EPXX EPYY EPZZ EPXY EPXZ EPYZ
node1 N2549 finalmoy EPSI_ELNO 1 0.00000E+00 0.00000E+00 1.00000E+01 3.50000E+01 0.00000E+00 6.26777E-04 -1.78490E-04 0.00000E+00 -1.63122E-05 0.00000E+00 0.00000E+00
node2 N2556 finalmoy EPSI_ELNO 1 0.00000E+00 0.00000E+00 1.00000E+01 5.00000E+00 0.00000E+00 6.26779E-04 -1.78490E-04 0.00000E+00 1.63087E-05 0.00000E+00 0.00000E+00
node3 N2561 finalmoy EPSI_ELNO 1 0.00000E+00 0.00000E+00 9.00000E+01 3.50000E+01 0.00000E+00 6.06777E-04 -1.82032E-04 0.00000E+00 3.99969E-08 0.00000E+00 0.00000E+00
node4 N2570 finalmoy EPSI_ELNO 1 0.00000E+00 0.00000E+00 9.00000E+01 5.00000E+00 0.00000E+00 6.06777E-04 -1.82032E-04 0.00000E+00 -3.99968E-08 0.00000E+00 0.00000E+00
You can read the file using readmatrix. First, you can specify some import options with delimitedTextImportOptions. For your particular example, it is sufficient to specify that the data starts at line 4, and that you want to join delimiters (spaces).
opts = delimitedTextImportOptions('DataLines',4, 'Delimiter', ' ', 'ConsecutiveDelimitersRule', 'join')
A = readmatrix('yourfile.txt', opts) % results in cell array, due to mixed numbers and strings
Then you can select the last 6 columns of the cell array A, and convert the strings to numbers:
data_of_interest = str2double(A(:,end-5:end));