Save workspace distributed arrays and Composite objects to disk


dsave filename
dsave filename X
dsave filename X Y Z


dsave without any arguments creates the binary file named matlab.mat and writes to the file all workspace variables, including distributed arrays and Composite objects. You can retrieve the variable data using dload.

dsave filename saves all workspace variables to the binary file named filename.mat. If you do not specify an extension for filename, it assumes the extension .mat.

dsave filename X saves only variable X to the file.

dsave filename X Y Z saves X, Y, and Z. dsave does not support wildcards, nor the -regexp option.

dsave does not support saving sparse distributed arrays.


With a parallel pool open, create and save several variables to mydatafile.mat:

D = rand(1000,'distributed'); % Distributed array
C = Composite();              %
C{1} = magic(20);             % Data on worker 1 only 
X = rand(40);                 % Client workspace only
dsave mydatafile D C X        % Save all three variables
Was this topic helpful?