Adding clock in GUI?

조회 수: 4 (최근 30일)
JB
JB 2015년 11월 16일
편집: JB 2015년 11월 16일
Hello,
can someone help me in adding the current date and time in the static text box in my GUI?
Thanks alot
  댓글 수: 1
JB
JB 2015년 11월 16일
I am working in GUIDE..I have already seen the one in file section.

댓글을 달려면 로그인하십시오.

답변 (1개)

TastyPastry
TastyPastry 2015년 11월 16일
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().
  댓글 수: 3
Joseph Cheng
Joseph Cheng 2015년 11월 16일
make sure you do not have another function called datetime. datetime is a built in matlab function. if you are unsure if you have another function called date time try first
datetime('now') %should give current date and time.
if that fails then try
which datetime
and see if there is more than one entry and that the only return is located in matlab installation folder.
JB
JB 2015년 11월 16일
편집: JB 2015년 11월 16일
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?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by