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
 All Forums
 Origin Forum
 Origin Forum
 Importing a Matlab datetime variable

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
hr829 Posted - 02/26/2016 : 12:54:43 PM
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.
3   L A T E S T    R E P L I E S    (Newest First)
KenLefebvre Posted - 02/29/2016 : 4:02:41 PM
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
hr829 Posted - 02/29/2016 : 3:00:15 PM
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.
KenLefebvre Posted - 02/26/2016 : 5:56:27 PM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000