MATLAB: How to read a data from txt file: only a specific part of txt

read txt

Hi; I have a txt file as above.I want to get the value from marked section of txt and assign it to a variable.

Best Answer

You can use regexp to match the sampling value. The expression below assumes that the character "E" is followed by a "-" character.
text = fileread('20171109_144634_14306_6O61N2.txt');
[match] = regexp(text,'(\d*\.\d*E-\d*)','match');
sampling = str2double(match{1});
sampling =
0.0050