MATLAB: Read matrix from a txt file after a specific expression

MATLABread matrixstring expressiontxt file

Hello i m new with matlab, i need to read in a text file after a specific expression 'This section' and 3 header lines (A, B and C) a matrix with 3 colones and 10 rows
This section
A
B
C
1 23.0 5.33
2 12.4 6.07
10 22.4 64.07

Best Answer

You should use TEXTREAD with the 'heaerlines' parameter set to the number of lines (e.g. 3) that characterizes your header.
For example:
>> [id,temp,press] = textread('myData.txt', '%f %f %f', 'headerlines', 3)
id =
1
2
10
temp =
23.0000
12.4000
22.4000
press =
5.3300
6.0700
64.0700
Related Question