timestamp in command window
23 views (last 30 days)
Show older comments
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 Comments
Answers (2)
the cyclist
on 5 Nov 2011
That functionality is not native to MATLAB, but the following File Exchange function will do what you want:
0 Comments
Walter Roberson
on 5 Nov 2011
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 Comments
See Also
Categories
Find more on Environment and Settings 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!