Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: CSVweatherdata
Replies: 4   Last Post: Dec 8, 2012 8:18 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Ehsan

Posts: 9
Registered: 12/7/12
Re: CSVweatherdata
Posted: Dec 8, 2012 8:18 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I use xlsread for weather data and importdata for dates and actually because I have this ' in the data so matlab is not able to read them, but once I was able to read them in this format 1/1/2012 5:43 but I cant separate them to the arrays and vectors!!

a=importdata(CSVfilename); % Import CSV weather file
b=a.textdata(19:end,1);
year = cellfun(@(x) x(7:10), b, 'UniformOutput', false);
year = cellfun(@(x)str2double(x), year);
month = cellfun(@(x) x(4:5), b, 'UniformOutput', false);
month = cellfun(@(x)str2double(x), month);
day = cellfun(@(x) x(1:2), b, 'UniformOutput', false);
day = cellfun(@(x)str2double(x), day);



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.