Section: Input/Ouput Functions
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.
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 A float [512 512] D cell [1 3] ans double [0 0] fp uint32 [1 1] i int32 [1 1] l cell [1 5] n uint32 [1 1] s string [1 11] x double [512 1] y float [1 1024] z float [512 512] --> 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 A float [512 512] D cell [1 3] ans double [0 0] fp uint32 [1 1] i int32 [1 1] l cell [1 5] n uint32 [1 1] s string [1 11] x double [512 1] y float [1 1024] z float [512 512]