User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » MATLAB help Page [1]  
JP
All American
16807 Posts
user info
edit post

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=72327

The 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

clalias
All American
1580 Posts
user info
edit post

which read command are you trying to use?

6/2/2006 1:37:32 PM

JP
All American
16807 Posts
user info
edit post

textread([dir,infiles(f,: )]

[Edited on June 2, 2006 at 1:45 PM. Reason : no smiley]

6/2/2006 1:44:56 PM

clalias
All American
1580 Posts
user info
edit post

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.9

Then 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

sober46an3
All American
47925 Posts
user info
edit post

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

clalias
All American
1580 Posts
user info
edit post

^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

JP
All American
16807 Posts
user info
edit post

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

sober46an3
All American
47925 Posts
user info
edit post

^^oops, i didnt notice the missing data

6/2/2006 2:32:31 PM

 Message Boards » Tech Talk » MATLAB help Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.