You don’t supply a lot of specific information, so I can’t provide a specific answer.
You can deal with the missing data fields by specifying a value for the 'EmptyValue' parameter. See the section of textscan ‘Name-Value Pair Arguments’ under 'EmptyValue'. Stopping at a string character may be more difficult, because you do not specify what the non-numeric values are. An example of one way to deal with that is (with ‘fidi’ being the input file ID):
D1 = textscan(fidi, '%f %f', 'HeaderLines',2, 'Delimiter','\n', 'CollectOutput',1);
fseek(fidi,0,0);
D2 = textscan(fidi, '%f %f', 'HeaderLines',2, 'Delimiter','\n', 'CollectOutput',1);
This instructs textscan to read to the first interruption, the start itself again and read through the rest of the file. (This example is from my archived code. In this instance, the file had only one header in the middle of the file, with the same number of header lines as the beginning of the file. You can combine the ‘D1’ and ‘D2’ variables here, or keep them separate, depending on the nature of your data.)
Best Answer