I want to import thef following txt file in matlab.
Run Local Local Local Local First-order
Index exitflag f(x) # iter F-count optimality
1 -10 14
2 3 1.239e-09 39 40 3.484e-06
3 3 3.028e-22 45 46 2.174e-12
4 -10 4
5 -10 7
6 3 5.749e-13 17 18 5.438e-08
7 -10 3
8 -10 2
9 -10 5
10 -10 1
11 -10 2
12 -10 3
13 -10 5
14 -10 1
15 -10 2
16 -10 2
MultiStart completed some of the runs from the start points.
3 out of 16 local solver runs converged with a positive local solver exit flag.
As you can see, there are a couple of blank cells and lines of text at the end and beginning of the file. I am only interested in the numerical data, which is a 16x6 matrix for that particular txt file. The empty cells be NaN.
Importdata is able to separate the text from the numerical data, however, thinks that there are only 3 columns because there are three blank cells in the first row. If I remove the text lines manually and call readtable(), there are, for whatever reasons, the first three lines of the numerical data missing.
How can I get the 16x6 matrix from the text file where blank cells = NaN?
I will consider using regular expression instead of some functions like readtable(). But the following codes are not general and for only suggestions.