Load compile-time constants from MAT-file or ASCII file into caller workspace
S = coder.load(filename)
S = coder.load(filename,var1,...,varN)
S = coder.load(filename,'-regexp',expr1,...,exprN)
S = coder.load(filename,'-ascii')
S = coder.load(filename,'-mat')
S = coder.load(filename,'-mat',var1,...,varN)
S = coder.load(filename,'-mat','-regexp', expr1,...,exprN)
loads
only the specified variables from the MAT-file S
= coder.load(filename
,var1,...,varN
)filename
.
loads
only the variables that match the specified regular expressions.S
= coder.load(filename
,'-regexp'
,expr1,...,exprN
)
treats S
= coder.load(filename
,'-mat'
,var1,...,varN
) filename
as
a MAT-file and loads only the specified variables from the file.
treats S
= coder.load(filename
,'-mat'
,'-regexp'
, expr1,...,exprN
)filename
as
a MAT-file and loads only the variables that match the specified regular
expressions.
coder.load
does not support loading
objects.
Arguments to coder.load
must be
compile-time constants.
The output S
must be the name of
a structure or array without any subscripting.
For example, S(i) = coder.load('myFile.mat')
is
not allowed.
You cannot use save
to save workspace
data to a file inside a function intended for code generation. The
code generator does not support the save
function.
Furthermore, you cannot use coder.extrinsic
with save
.
Prior to generating code, you can use save
to save
workspace data to a file.
coder.load
loads data at compile
time, not at run time. If you are generating MEX code or code for Simulink® simulation,
you can use the MATLAB function load
to load
run-time values.
If the MAT-file contains unsupported constructs, use coder.load(filename,var1,...,varN)
to
load only the supported constructs.
If you generate code in a MATLAB
Coder™ project,
the code generator practices incremental code generation for the coder.load
function.
When the MAT-file or ASCII file used by coder.load
changes,
the software rebuilds the code.