Excel来matlab时间戳

我有excel中的数据以时间戳的forms出现

30/11/12 12:42 AM 30/11/12 12:47 AM 30/11/12 12:56 AM 30/11/12 1:01 AM 

我需要把它看成是这样的matlab

 dateStrings = {... '30/11/12 12:42 AM' ... '30/11/12 12:47 AM' ... '30/11/12 12:56 AM' ... '30/11/12 1:01 AM' ... }; 

我已经尝试过xlsread,但没有放入string。

下面的代码适用于我(在Octave中,但在MATLAB中应该是一样的):

 >> [num,txt,raw]=xlsread('dates.xls','A1:A4') num = 4.1243e+004 4.1243e+004 4.1243e+004 4.1243e+004 txt = {}(0x0) raw = { [1,1] = 4.1243e+004 [2,1] = 4.1243e+004 [3,1] = 4.1243e+004 [4,1] = 4.1243e+004 } >> datestr(num+datenum(1900,1,1,0,0,0)-2) ans = 30-Nov-2012 00:42:00 30-Nov-2012 00:47:00 30-Nov-2012 00:56:00 30-Nov-2012 01:01:00 >> whos ans Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== ans 4x20 80 char Total is 80 elements using 80 bytes 

查看各种输出格式选项的datestr函数。

阿尔诺

我设法find解决方法

 1. Copy and paste your dates into Excel in dd-mm-yyyy format 2. In Excel, highlight the data and go Right Click, Format Cells/Number 3. In Matlab go a=xlsread(xlsfile); 4. Type datestr(a+693960)