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

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 25 日
編集済み: Azzi Abdelmalek 2012 年 10 月 25 日

0 投票

fid=fopen('data1.txt');
A=textscan(fid,'%s%s%s%s%s%s%s%s%s%s%s%s%s','delimiter',',');
fclose(fid);

2 件のコメント

Innosens
Innosens 2012 年 10 月 25 日
Thanks Azzi ......
Innosens
Innosens 2012 年 10 月 25 日
can i use textread for this data ?

サインインしてコメントする。

その他の回答 (1 件)

Sachin Ganjare
Sachin Ganjare 2012 年 10 月 25 日
編集済み: Sachin Ganjare 2012 年 10 月 25 日

0 投票

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

5 件のコメント

Innosens
Innosens 2012 年 10 月 25 日
the data containing the string and character can 'csvread' used read it?
Sachin Ganjare
Sachin Ganjare 2012 年 10 月 25 日
編集済み: Sachin Ganjare 2012 年 10 月 25 日
Then you try 'textscan' function if you want formatted data.
Refer link below for details:
Hope it helps!!!
Innosens
Innosens 2012 年 10 月 25 日
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
Innosens
Innosens 2012 年 10 月 25 日
Sachin Ganjare
Sachin Ganjare 2012 年 10 月 25 日
First capture data from website using 'urlread', you will get data in string.
Then use 'strread' function to parse the weather data.

サインインしてコメントする。

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by