Adding clock in GUI?

9 views (last 30 days)
JB on 16 Nov 2015
Edited: JB on 16 Nov 2015
can someone help me in adding the current date and time in the static text box in my GUI?
Thanks alot
  1 Comment
JB on 16 Nov 2015
I am working in GUIDE..I have already seen the one in file section.

Sign in to comment.

Answers (1)

TastyPastry on 16 Nov 2015
You can do something like this:
t = datestr(datetime('now','TimeZone','local','Format','d-MMM-y HH:mm:ss Z'));
This will give you
t = 16-Nov-2015 14:46:33
where t is a string. You can modify the format in the first line. Then, just add this string to your uicontrol().
JB on 16 Nov 2015
i am not using datetime function in my code.I have even tried with which datatime,but same consequences.
I am using Matlab R2013b. Can this be the cause?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by