필터 지우기
필터 지우기

Date and time range picker from user

조회 수: 15 (최근 30일)
Luca D'Angelo
Luca D'Angelo 2023년 5월 23일
답변: Rik 2023년 5월 23일
Hi all,
I'm writing a script (not with App designer) and I want to creating a gui where it is asked to insert beginning and ending date ("dd-MM-yyyy") and time ("hh:mm") of a specific event (like collection of blank data).
I like a lot the uidatepicker and I'd like to use an interface like that one.
So I wrote this:
fig = uifigure('Position',[500 500 375 280]);
dstart = uidatepicker(fig,'Position',[18 225 150 22]);
dend = uidatepicker(fig,'Position',[18 200 150 22]);
But:
  • I don't know how to ask for the time too;
  • I don't know how to "record" the data and to use them (like with the "timerange" function) since I don't understand when dstart.Value actually write the data: is there a way to create a button like "ok" or "acquire" in order to write the input?
  • I don't know which would be the command to close the gui
Thank you for your reply.
Luca

답변 (1개)

Rik
Rik 2023년 5월 23일
You might be interested in this example. You can easilly create an 'ok' button that will retrieve the set dates and times and closes the GUI.
Either close(fig) or delete(fig) will close the uifigure.
Note that you should consider using functions instead of script for anything you plan on using after next week. Functions provide an interface you can document and have their own workspace which is independent from the rest of the environment.

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by