No?
Printing to screen with fprintf. Reclaim back the printed result after clearing the screen.
27 views (last 30 days)
Show older comments
Suppose I use the fprintf as follows:
name='John';
height=1.8;
age=27;
fprintf('Name.............%s\n\n', name);
fprintf('Height...........%.2f m\n',height);
fprintf('Age..............%d \n',age);
Is there any way to reclaim the printed result after clearing the screen with:
clc
3 Comments
Cedric
on 12 Aug 2013
Type
doc diary
in the command window. However, why would you reclaim printed results? The diary is usually used as a logging mechanism I would say, and not for reclaiming previous output to command window on a regular basis. What we need in general is keeping data, which are not erased when you execute CLC.
Accepted Answer
Walter Roberson
on 13 Aug 2013
The results of fprintf() to the screen do not exist in the workspace, and are not obtainable through normal graphics routines.
However, I have not researched the advanced editor and command line capabilities that were added a couple of releases ago, so I hesitate to give a blanket "no". Maybe there would be a way to request a copy of what is in the command window just before you issue the clc(), and then re-output it after you issue the clc(). I'd be relatively sure you could not have this happen automatically whenever a clc() was issued (not without overriding the normal clc)
2 Comments
Walter Roberson
on 13 Aug 2013
Yes, you could probably build a function for that. You might also want to consider writing the output to a scrollable GUI element such as uicontrol('style', 'edit', 'enable', 'disable') (notice that is not 'enable', 'off')
More Answers (0)
See Also
Categories
Find more on Entering Commands 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!