I'm trying to read a text file, sort of like the one found here:http://weather.uwyo.edu/cgi-bin/sounding?region=naconf&TYPE=TEXT%3ALIST&YEAR=2006&MONTH=06&FROM=0212&TO=0212&STNM=72327The only thing is, when I read it in MATLAB, it will not read the columns right, i.e. the first row temperature value is actually the second row's pressure value (hopefully you can follow by looking at the link).The bottom lin eis I have hundreds of files to read and do not want to go through each one just to put 'NaN' in the missing values places. Any help would be fantastic!!
6/2/2006 1:18:25 PM
which read command are you trying to use?
6/2/2006 1:37:32 PM
textread([dir,infiles(f,: )][Edited on June 2, 2006 at 1:45 PM. Reason : no smiley]
6/2/2006 1:44:56 PM
hmmm, I think you are going to have to write a script using c-style commands. fread,scanstr etc...It wouldn't be too bad if all the data files have missing data on the first line only. But I doubt that's the case. Your data files have missing data points randomly in the data, right?Maybe someone on here could write a quick perl code to, for example, change to comma delimiter then transform your data to look like,1000.0,114,,,,,,,,,993.0,210,18.8,18.6,99,13.77,175,3,292.5,331.8,294.9Then you could get matlab to fill in NaN really easily.[Edited on June 2, 2006 at 2:15 PM. Reason : .][Edited on June 2, 2006 at 2:15 PM. Reason : .]
6/2/2006 2:14:49 PM
does it have a header...or is it just data?if its just data, you can just use "load text.txt" and it will allign everything.
6/2/2006 2:22:46 PM
^tried that. Load chokes because of the missing data. There is no delimiter to hold the place of the missing data.
6/2/2006 2:25:15 PM
if you wanna look at what i have, i can sent it to you to take a look at
6/2/2006 2:26:38 PM
^^oops, i didnt notice the missing data
6/2/2006 2:32:31 PM