MATLAB: How to save entire workspace

workspace

Hello everyone! Question. Is it possible to save the workspace completely, that is, including the workspaces of all functions, persistent variables, etc.? In order to be able to start at a desired moment, when it is desired for some event.

Best Answer

Workspaces of functions?
In the vast majority of cases only 1 function is ever running (and thus has a workspace) at any given moment and the only way saving its workspace would make sense is if you interrupt that function midway through, in which case you could just save its workspace with
save( filename )
as you would for the main workspace to save all variables in it.
save( filename, '-append' )
will append to an existing workspace if you save the base workspace then want to add to it with a breakpoint in a function workspace.