Time difference between two sets of times in hrs mins and seconds.. GUI if possible
Afficher commentaires plus anciens
Hi im new to MATLAB and trying to setup a GUI to calculate the time difference between two sets of times. Eg: 10:00:00 and 11:01:00
Difference would be 1 hr 1min and 0 seconds..
thanks in advance
Réponse acceptée
Plus de réponses (2)
Sean de Wolski
le 19 Oct 2011
So start by opening GUIDE
guide %at the command line
Then draw the GUI so that it has edit boxes to enter times, static boxes to give directions, and a push button to press to give you the times. After that, write the functions to do the work. Or write the functions to do the work first and then add them to a GUI. Ask specific detailed MATLAB questions here when you get stuck.
Welcome to MATLAB Answers!
1 commentaire
Sharon
le 19 Oct 2011
Real User
le 20 Jan 2023
>> duration("11:01:00")-duration("10:00:00")
ans =
duration
01:01:00
>> string(duration("11:01:00")-duration("10:00:00"))
ans =
"01:01:00"
>> [h, m, s]=hms(duration("11:01:00")-duration("10:00:00"))
h =
1
m =
1
s =
0
>> d = duration(h,m,s)
d =
duration
01:01:00
These work even if you include the dates.
[m,d,t] = split(T,{'months','days','time'})
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!