How do I make an app on appdesigner that when a button is pressed and the current time is later than an indicated time
조회 수: 2 (최근 30일)
이전 댓글 표시
i need to make an app on appdesigner that when a button is pressed and the current time is later than an indicated time. e.g. i press button (timenow:8:00am) and (indicatedtime:7:00am) and since 8:00>7:00 it will display "you are late"
댓글 수: 0
답변 (1개)
Kevin Holly
2022년 2월 23일
You could create a pushbutton with the following callback:
% Button pushed function: Button
function ButtonPushed(app, event)
timenow = datetime('now');
indicatedtime = datetime('23-Feb-2022 08:00:00');
if timenow>indicatedtime
disp("You are late") % this will be displayed in command window.
app.Label.Text = "You are late"; % You could create a label component on your UI and change text as such
end
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!