clock should return whole numbers.

clock command results in:
clock
ans =
1.0e+003 *
2.0120 0.0080 0.0260 0.0160 0.0590 0.0028
but i want answer in the form
[2012 8 26 16 59 2.848]

 채택된 답변

Walter Roberson
Walter Roberson 2012년 8월 26일

1 개 추천

See the command "format", such as
format long g

댓글 수: 1

Explicitly: FORMAT does not change the clock format and there is not reason to change it. But the method to display a vector in the command window is affected by FORMAT. Another method, which is independent from the FORMAT setting:
fprintf('%.4g ', clock)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Clocks and Timers에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by