Convert a column of dates

1 Ansicht (letzte 30 Tage)
Stephen Jones
Stephen Jones am 15 Mär. 2012
Kommentiert: Sara Mendiola am 1 Mär. 2017
I can use the datenum command for individual cells, but can not seem to apply it to a whole column. What am I doing wrong? Thanks, Stephen

Akzeptierte Antwort

Honglei Chen
Honglei Chen am 15 Mär. 2012
try cellfun
cellfun(@datenum,...
see the doc
doc cellfun

Weitere Antworten (1)

Jan
Jan am 15 Mär. 2012
datenum does accept a column cell:
datenum({'15-Mar-2012 23:53:23'; '15-Mar-2012 23:53:23'})
>> ans =
7.3494e+005
7.3494e+005
  3 Kommentare
Jan
Jan am 16 Mär. 2012
I suggest to read the documentation: help datenum, doc datenum
There you find:
datenum({'20120315'; '20120316'}, 'yyyymmdd')
Sara Mendiola
Sara Mendiola am 1 Mär. 2017
How about datestr for a column?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Time Series Objects finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by