how to import data into matlab

I have data from weather underground, i want to import this data into matlab, how i can import this data to matlab. please help me......
this example the data....
TimeMYT,TemperatureC,Dew PointC,Humidity,Sea Level PressurehPa,VisibilityKm,Wind Direction,Wind SpeedKm/h,Gust SpeedKm/h,Precipitationmm,Events,Conditions,WindDirDegrees,DateUTC 12:00 AM,25.0,24.0,94,1007,10.0,East,7.4,-,N/A,,Mostly Cloudy,100,2012-10-24 16:00:00 12:30 AM,25.0,24.0,94,1007,10.0,ESE,7.4,-,N/A,,Mostly Cloudy,110,2012-10-24 16:30:00 1:00 AM,25.0,23.0,89,1007,10.0,ESE,9.3,-,N/A,,Mostly Cloudy,110,2012-10-24 17:00:00 1:30 AM,24.0,23.0,94,1007,10.0,ESE,11.1,-,N/A,,Mostly Cloudy,110,2012-10-24 17:30:00 2:00 AM,24,23,92,1007,18,ESE,7.4,,,,Scattered Clouds,110,2012-10-24 18:00:00 2:00 AM,24.0,23.0,94,1006,10.0,ESE,7.4,-,N/A,,Mostly Cloudy,110,2012-10-24 18:00:00 2:30 AM,24.0,23.0,94,1006,10.0,ESE,9.3,-,N/A,,Mostly Cloudy,110,2012-10-24 18:30:00 3:00 AM,24.0,23.0,94,1006,10.0,ESE,7.4,-,N/A,,Mostly Cloudy,110,2012-10-24 19:00:00 3:30 AM,24.0,23.0,94,1006,10.0,ESE,11.1,-,N/A,,Mostly Cloudy,110,2012-10-24 19:30:00 4:00 AM,24.0,23.0,94,1006,10.0,ESE,7.4,-,N/A,,Mostly Cloudy,120,2012-10-24 20:00:00 4:30 AM,25.0,23.0,89,1006,10.0,ESE,9.3,-,N/A,,Mostly Cloudy,110,2012-10-24 20:30:00 5:00 AM,24,23,88,1006,18,ESE,7.4,,,,Scattered Clouds,110,2012-10-24 21:00:00 5:00 AM,24.0,23.0,94,1006,10.0,ESE,7.4,-,N/A,,Mostly Cloudy,110,2012-10-24 21:00:00 5:30 AM,25.0,23.0,89,1006,10.0,ESE,7.4,-,N/A,,Mostly Cloudy,120,2012-10-24 21:30:00 6:00 AM,24.0,23.0,94,1006,10.0,ESE,7.4,-,N/A,,Mostly Cloudy,120,2012-10-24 22:00:00 6:30 AM,24.0,23.0,94,1007,10.0,ESE,5.6,-,N/A,,Mostly Cloudy,120,2012-10-24 22:30:00 7:00 AM,25.0,23.0,89,1007,10.0,ESE,5.6,-,N/A,,Mostly Cloudy,120,2012-10-24 23:00:00 7:30 AM,25.0,22.0,83,1008,10.0,ESE,9.3,-,N/A,,Mostly Cloudy,120,2012-10-24 23:30:00 8:00 AM,25,23,80,1009,15,North,5.6,,,,Overcast,0,2012-10-25 00:00:00 8:00 AM,25.0,23.0,89,1008,10.0,North,5.6,-,N/A,,Mostly Cloudy,360,2012-10-25 00:00:00 8:30 AM,25.0,25.0,100,1009,4.0,NW,14.8,-,N/A,Rain,Rain,310,2012-10-25 00:30:00 9:00 AM,25.0,24.0,94,1008,4.0,ESE,1.9,-,N/A,Rain,Rain,110,2012-10-25 01:00:00 9:30 AM,26.0,25.0,94,1009,5.0,South,9.3,-,N/A,Rain,Light Rain,170,2012-10-25 01:30:00 10:00 AM,26.0,25.0,94,1009,5.0,SSE,9.3,-,N/A,Rain,Light Rain,160,2012-10-25 02:00:00

 Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 25 Ott 2012
Modificato: Azzi Abdelmalek il 25 Ott 2012
fid=fopen('data1.txt');
A=textscan(fid,'%s%s%s%s%s%s%s%s%s%s%s%s%s','delimiter',',');
fclose(fid);

2 Commenti

Innosens
Innosens il 25 Ott 2012
Thanks Azzi ......
Innosens
Innosens il 25 Ott 2012
can i use textread for this data ?

Accedi per commentare.

Più risposte (1)

Sachin Ganjare
Sachin Ganjare il 25 Ott 2012
Modificato: Sachin Ganjare il 25 Ott 2012

0 voti

If this data is in .csv format then you can 'csvread' function in matlab.
Refer this link:

5 Commenti

Innosens
Innosens il 25 Ott 2012
the data containing the string and character can 'csvread' used read it?
Sachin Ganjare
Sachin Ganjare il 25 Ott 2012
Modificato: Sachin Ganjare il 25 Ott 2012
Then you try 'textscan' function if you want formatted data.
Refer link below for details:
Hope it helps!!!
Innosens
Innosens il 25 Ott 2012
i have try the function, but error .... this is the error: ??? Error using ==> dlmread at 145 Mismatch between file and format string. Trouble reading number from file (row 1, field 1) ==> TimeM
Error in ==> csvread at 52 m=dlmread(filename, ',', r, c); thanks
First capture data from website using 'urlread', you will get data in string.
Then use 'strread' function to parse the weather data.

Accedi per commentare.

Categorie

Scopri di più su Weather and Atmospheric Science in Centro assistenza e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by