Change directory for printing Command window to PDF
25 views (last 30 days)
Show older comments
I am trying to print the text within the Command window to PDF in a specific directory (working MATLAB directory would be fine).
Currently, I have been selecting the "3 dots" at the top right of the command window and using the GUI to print to PDF. Whenever I print to PDF, the files print to a very obsure directory by default on my Mac computer: /private/var/folders/g1/49v_85w527gdpwpb67k6_t0c0000gp/T
I then need to move these PDFs to a new more accessible directory. Is there a way to set the default file directory for this?
These are the options I am seeing for printing to PDF:

I could just copy and paste the text into some word processing software and then print, but there has to be some way to reset this.
Details: MacBook Air M1 chip, running 26.0.1 (25A362). Running MATLAB R2025a.
0 Comments
Answers (1)
dpb
on 27 Oct 2025 at 14:58
Edited: dpb
on 27 Oct 2025 at 15:13
I can find no defined settings for the Command Window print function; one would think there should be a way to select the output file location which would then be retained or a preference setting somewhere.
I'd suggest this would be an appropriate enhancement request.
Submit this to Mathworks as an official support request at <Product Support Page>; somebody who knows the internals of the new desktop really, really well might be able to supply a workaround for present use.
_"... files print to ... /private/var/folders/g1/49v_85w527gdpwpb67k6_t0c0000gp/T
Is this location constant or is it generated as a different random location every time? If it were constant, one slight improvement would be to write a little utility m-file that would move the content of that directory to a location of choice.
2 Comments
dpb
on 28 Oct 2025 at 14:05
I'd guess not a real bug but simply a "not implemented yet" functionality.
I don't have the new desktop versions installed so can't go poking around; the only recourse I could imagine other than official Mathworks support would be to see if you could find the print callback function and see if by any chance it were m code in which you could manage to change a hardcoded folder. Not exactly recommended, but once in a great while one can change builtin behavior of MATLAB to suit a particular use case.
It clearly is a quality of implementation isssue; if one is going to have such a functionality, it certainly needs the facility for the user to change the location and file name. Who knows, there may be a hidden property somewhere they could point at for a workaround in the meantime....not likely, but not impossible.
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!