how do I import date from .xls where cell contains numbers and letters

1 次查看(过去 30 天)
I am trying to import a .xls data file using [num, txt] = xlsread(filename);. I got the file to import giving me a number file and a text file. The text file includes the dates in format: [10-1-2005 0:05 MDT] all in one cell. I am trying to get the date and time into a datevector so that I can organize and graph the data in fractional years. Anyone know how I can extract the date and time and leave out the time zone?
Thanks in advance ryan

采纳的回答

Leah
Leah 2013-6-4
try strrep and replace with ''

更多回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-6-4
编辑:Azzi Abdelmalek 2013-6-4
s={'10-1-2005 0:05 MDT';'11-1-2005 0:05 MDT'}
s=cellfun(@(x) datenum(strrep(x,'MDT','')),s)
dat=datestr(s,'dd-mm-yyyy HH:MM')

类别

Help CenterFile Exchange 中查找有关 Word games 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by