Excel to matlab timestamps

I have data in excel in form of timestamps s it looks like

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

I need to get it to matlab to look like this

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' ...

I have tried xlsread but it doesn't put in the strings.


The following works for me (in Octave, but should be the same in MATLAB):

>> [num,txt,raw]=xlsread('dates.xls','A1:A4')
num =


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

Check out the datestr function for the various output format options.


I manage to find a way how to solve it

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)

Need Your Help

How to center align a UILabel on top of an UIImageView

ios uiimageview uilabel

I have an UIImageView that has a UILabel on top of it. This UILabel has a text that shows a number to the user of how many people like his content ( kinda like the Facebook likes or comments ),

How to draw a screenshot “preview” window?

c# winforms drawing screenshot

I have a Winforms application that the user uses to take a region based screenshot. I want to have a small preview pane, but i'm not sure how to do it. So far i tried recreating a bitmap on mouse m...