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

 Respuesta aceptada

Honglei Chen
Honglei Chen el 15 de Mzo. de 2012

0 votos

try cellfun
cellfun(@datenum,...
see the doc
doc cellfun

Más respuestas (1)

Jan
Jan el 15 de Mzo. de 2012

0 votos

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 comentarios

Stephen Jones
Stephen Jones el 16 de Mzo. de 2012
Jan,
Thanks, but I have a long column of dates, in the format of yyyymmdd. Is there a way to use datenum in this situation?
Stephen
Jan
Jan el 16 de Mzo. de 2012
I suggest to read the documentation: help datenum, doc datenum
There you find:
datenum({'20120315'; '20120316'}, 'yyyymmdd')
Sara Mendiola
Sara Mendiola el 1 de Mzo. de 2017
How about datestr for a column?

Iniciar sesión para comentar.

Categorías

Preguntada:

el 15 de Mzo. de 2012

Comentada:

el 1 de Mzo. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by