Hi everybody,
I want to read only "a specific number" (Bolded below) in a text file, which i've got from a Website simultaneously and print that numbers in another file. The file is a mixture of strings and numbers and look like as follows:
Hamburg-Fuhlsbuettel, Germany (EDDH) 53-38N 010-00E 15M
Jan 06, 2020 – 02:50 PM EST / 2020.01.06 1950 UTC
Wind: from the S (190 degrees) at 10 MPH (9 KT):0
Visibility: greater than 7 mile(s):0
Sky conditions: partly cloudy
Temperature: 41 F (5 C)
Dew Point: 33 F (1 C)
Relative Humidity: 75%
Pressure (altimeter): 30.12 in. Hg (1020 hPa)
ob: EDDH 061950Z 19009KT 9999 SCT021 05/01 Q1020 NOSIG
cycle: 20
*****************************************************
I'd tried it with this matlab code:
request = webread('http://tgftp.nws.noaa.gov/data/observations/metar/decoded/EDDH.TXT'); %EDDH OIMM EGDX
fid=fopen('weather.txt','w');fprintf(fid,'%s\n',request);% a=string(request);
% a=split(request,'\n');
fclose(fid);c=textread('weather.txt','%s','delimiter','\n')Temp=extractBetween(c(6,:),"(","C"); LuftF=extractBetween(string(c(8,1)),': ','%'); LuftD=extractBetween(string(c(9,1)),'Hg (','hPa'); Tempe=str2double(Temp);LuftFeu=str2double(LuftF);LuftDru=str2double(LuftD);% fW=fopen('T_P_H.txt','w+');
% fprintf(fW,'%s\n',request);
disp(' Tempe[°C] LuftDru[hPa] LuftFeu[%]');M=[Tempe,LuftDru,LuftFeu]
but the Problem is here the number of Line for (Temperature,Humidity,Pressure) changed over the time. Could you please help me to solve the problem ? Many thanks in advance.
best Regards
Best Answer