Loads a set of variables from a file in a machine independent format.
The load
function takes one argument:
load filename,
or alternately,
load('filename')
This command is the companion to save
. It loads the contents of the
file generated by save
back into the current context. Global and
persistent variables are also loaded and flagged appropriately.
Here is a simple example of save
/load
. First, we save some variables to a file.
--> D = {1,5,'hello'}; --> s = 'test string'; --> x = randn(512,1); --> z = zeros(512); --> who Variable Name Type Flags Size D cell [1 3] s string [1 11] x double [512 1] z float [512 512] ans double [] --> save loadsave.dat
Next, we clear all of the variables, and then load them back from the file.
--> clear all --> who Variable Name Type Flags Size --> load loadsave.dat --> who Variable Name Type Flags Size D cell [1 3] s string [1 11] x double [512 1] z float [512 512] ans double []