Hello,
I want to read the latitude and longitude values (Station and Epicenter) from the following text file.
... ...Station 37.94 N 47.54 E Altitude 1699m Azimuth L 0 T 90 Vs30 406Epicenter 37.99 N 48.15 E FD 28 Km Mb0 Ms0 Mw6 Mn0 ML6.2 ... ...
I used the following code for reading geographic coordinate of station
fid=fopen(FileName,'r') ; text1 = textscan(fid,'%s','Delimiter','','endofline',''); text1 = text1{1}{1}; SLa=regexp(text1,'Station[\s]+(\d*\.?\d+)','tokens') ; SLa=str2double([SLa{:}]) SLo=regexp(text1,'Station[\s] N +(\d*\.?\d+)','tokens') ; SLo=str2double([SLo{:}])
and I got the following results
SLa = 37.9400 SLo = NaN
I think I missed something in line 6, could you please help me to fix it?
Thanks
Best Answer