How to calculate (hh:mm:ss + minutes()) and show the all result in GUI table?
Show older comments
for i = 1:10
result(i, 2) = 08:00:00 + minutes(result(i,2))
end
set(handles.uitable1, 'data', result)
**************************************************************
Then, I will show result which is global variable into GUI table. How can I calculate and show it in GUI table?
Normally, I use minutes to calculate but I want to show the exact time (hh:m:ss) in GUI table. I, now, show the minutes at GUI table as below. Below figure shows result at GUI table. I need to convert it to hh:mm:ss with above for-loop.

Thanks,
4 Comments
Walter Roberson
on 2 Jan 2020
duration(8,0,0)
Or if you have a new enough version
duration('08:00:00')
snr matlb
on 2 Jan 2020
snr matlb
on 2 Jan 2020
Answers (1)
Amit
on 2 Jan 2020
Use clock function to display current time on your gui :
I hope the below code will help you.
for i =1:10
time= clock;
if time(4)>12
hr = time(4)-12;
result(i,:)= [hr, time(5:6)];
else
result(i,:) = time(4:6);
end
pause(1)
set(handles.uitable1, 'data', ceil(result))
end
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!