blob: 24b6bc513960870d1ff77c4f516833ba62a803ba (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
|
function num_as_str = get_time_as_string(millis)
%GET_TIME_AS_STRING Number of milliseconds, formatted mm:ss.s and rounded
% Detailed explanation goes here
minutes = num2str(fix(millis / (1000*60)));
seconds = mod(millis, 1000*60);
seconds_str = sprintf('%02d', fix(seconds / 1000));
rest_str = num2str(round(mod(seconds, 1000), -2) / 100);
num_as_str = strjoin({minutes, ':', seconds_str, '.', rest_str}, '');
end
|