필터 지우기
필터 지우기

How to compare real time with an entered time in a table cell in guide GUI?

조회 수: 1 (최근 30일)
Luay Hasiba
Luay Hasiba 2017년 11월 20일
댓글: KL 2017년 11월 20일
hello! i am a beginner user for guide . I am working on a GUI and i want to enter many times from a table, and compare these times with real time in order to do something. how could i do this?

채택된 답변

KL
KL 2017년 11월 20일
편집: KL 2017년 11월 20일
you can get the current time by using,
>> curr_time = datetime('now')
curr_time =
datetime
2017-11-20
  댓글 수: 2
Luay Hasiba
Luay Hasiba 2017년 11월 20일
yes i know this function , but my problem is comparing curr_time with many times inserted into the table.
KL
KL 2017년 11월 20일
Let's say you store all your "inserted times" in a variable,
dt = {'2017-11-19'; '2017-11-21'}; %dummy variable, you can replace it with yours
dt = datetime(dt);
now get the current time
dt_now = datetime('now');
now let's check which dates are in the past,
d_compare = dt<dt_now
d_compare =
2×1 logical array
1
0
meaning the first element is (19-11-2017) is in the past.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by