timestamp in command window
조회 수: 26 (최근 30일)
이전 댓글 표시
Hello,
Is there anyway I can enable timestamp for the command window all the time by default? not just when running a script. I would like it to display for both input and output, something like this:
[05.11.2011 15:38:23] >> 1+1
[05.11.2011 15:38:24] ans = 2
Thanks
댓글 수: 0
답변 (2개)
the cyclist
2011년 11월 5일
That functionality is not native to MATLAB, but the following File Exchange function will do what you want:
댓글 수: 0
Walter Roberson
2011년 11월 5일
Alas, the cyclist's answer will not timestamp each line of output, but it does nicely solve timestamping each >> prompt.
To timestamp each line of output, you would have to override the routines disp() and display() and fprintf() at the very least. Or, depending exactly how disp() and display() are implemented, perhaps only fprintf() .
I would hesitate strongly to override fprintf(): I think there is just too much potential for disaster in doing that.
In the situation where only the command line version of MATLAB was required, no graphics were required, and the desktop environment was not required, then there would be approaches to this that would be more secure, involving the use of pseudo-terminals (pttys). pseudo-terminals are fairly easy to set up in unix-like systems, and are theoretically available in MS Windows, but I have never used them myself in MS Windows.
On the other hand, MATLAB is not known for playing well with pseudo-terminals, in the sense that MATLAB for some reason overrides the standard line-buffering detection built in to unix and MS Windows and deliberately uses block-oriented buffering.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!