I need help doing this short program
2 ビュー (過去 30 日間)
古いコメントを表示
user is to input T1 in the formate hh:mm:ss
user is to input T2 in the formate hh:mm:ss
TM= 12:00:00
Tz= TM+T1-T2 (output in hh:mm:ss form)
Ty=(Tz/2)+T2 (output in hh:mm:ss form)
Tx=(Tz/3)*2 (output in hh:mm:ss form)
Tn=(Tx+T2) (output in hh:mm:ss form)
0 件のコメント
回答 (1 件)
Chunru
2022 年 9 月 1 日
Use duration function
% String
T1str = "02:30:31";
T2str = "08:06:45";
TMstr = "12:00:00";
% Convert to duration
T1 = duration(T1str)
T2 = duration(T2str)
TM = duration(TMstr)
% Duration calculation
Tz= TM + T1 - T2
% Do the rest yourself
5 件のコメント
Chunru
2022 年 9 月 2 日
% T1str = "02:30:31";
% Change above into the following
T1str = input("Enter T1 in format hh:mm:ss", "s");
% Do the same for T2str
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!