The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Importing a Matlab datetime variable
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hr829

15 Posts

Posted - 02/26/2016 :  12:54:43 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2016 Ver. 9.3 226
Operating System: Win7 Professional

I am trying to import a matlab datetime variable. The matlab format is:
30-Sep-2015 23:22:15
30-Sep-2015 23:22:16
(more details for this format can be found here: http://www.mathworks.com/help/matlab/ref/datetime.html).
I tried importing the data from a *.mat file and also by formatting a worksheet column with a custom date time format in Origin and pasting the data from matlab. None of them seem to work. Any ideas would be greatly appreciated.

KenLefebvre

USA
66 Posts

Posted - 02/26/2016 :  5:56:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Haris,

I created a column of arbitrary dates in Origin and gave it this custom format (dd-MMM-yyyy hh:mm:ss) which seems to display them the same way as your data.

I know sometimes there are issues with how other software handles dates vs. how Origin does (e.g. Excel does something different with the way it counts the Gregorian calendar). If you've already used that format and it still doesn't work for your data, you're always welcome to send your .MAT to us at Tech @ OriginLab.com, and we'd be glad to try to fix this on our end.

Best regards,


Ken Lefebvre
Technical Service Engineer
OriginLab
Go to Top of Page

hr829

15 Posts

Posted - 02/29/2016 :  3:00:15 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Kevin. If you type (create) a custom date and then apply the format you specified, then Origin does display the "correct" date but with the 12 hour format. So:
30-Sep-2015 23:22:15
would display as
30-Sep-2015 11:22:15
but you need to actually type the dates in that format.
Unfortunately I have thousands of datetime values so I need to either import a .mat file from Matlab or manually copy and paste from a matlab datetime array into an Origin column.
The mat file import always gives an error.
The copy and paste from a matlab datetime array does not work either. However, but if I copy and paste individual elements of the datetime array from matlab then the date works but not the time. I suspect matlab has some hidden formatting characters.
In any case I think I will have to convert all times into UTC seconds and account for the date rollover (when present).
thank you for your help.
Go to Top of Page

KenLefebvre

USA
66 Posts

Posted - 02/29/2016 :  4:02:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
No problem, apparently I was mistaken in my formatting, for a 24 hour time you'll want to use capital "H's" (HH:mm...)

Again, if you're still having trouble, you can always send your data to our tech email (tech@originlab.com) and we can try to troubleshoot this on our end as well!

Ken
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000