How to compare real time with an entered time in a table cell in guide GUI?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Luay Hasiba
el 20 de Nov. de 2017
Comentada: KL
el 20 de Nov. de 2017
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?
0 comentarios
Respuesta aceptada
KL
el 20 de Nov. de 2017
Editada: KL
el 20 de Nov. de 2017
you can get the current time by using,
>> curr_time = datetime('now')
curr_time =
datetime
2017-11-20
2 comentarios
KL
el 20 de Nov. de 2017
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!