Skip to Main Content Skip to Search
Product Documentation

psave - Save data from parallel job session

Syntax

psave(fileroot)

Arguments

fileroot

Part of filename common to all saved files.

Description

psave(fileroot) saves the data from the workers' workspace into the files named [fileroot num2str(labindex)]. The files can be loaded by using the pload command with the same fileroot, which should point to a folder accessible to all the workers. If fileroot contains an extension, the character representation of the labindex is inserted before the extension. Thus, psave('abc') creates the files 'abc1.mat', 'abc2.mat', etc., one for each worker.

Examples

This example works in a communicating (parallel) job or in pmode, but not in a parfor or spmd block. Create three arrays — one replicated, one variant, and one codistributed. Then save the data.

clear all;
rep = speye(numlabs);
var = magic(labindex);
D = eye(numlabs,codistributor());
psave('threeThings');

This creates three files (threeThings1.mat, threeThings2.mat, threeThings3.mat) in the current working directory.

Clear the workspace on all the workers and confirm there are no variables.

clear all
whos

Load the previously saved data into the labs. Confirm its presence.

pload('threeThings');
whos
isreplicated(rep)
iscodistributed(D)

See Also

labindex | load | numlabs | pload | pmode | save

  


Free Parallel Computing Interactive Kit

See how to solve large problems with minimal effort and reduce simulation time.

Get free kit

Trials Available

Try the latest versions of parallel computing products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS