load
Load instrument objects and variables into MATLAB workspace
Syntax
load filename
load filename obj1 obj2 ...
out = load('filename','obj1','obj2',...)
Arguments
| The MAT file name. |
| Instrument objects or arrays of instrument objects. |
| A structure containing the specified instrument objects. |
Description
load filename
returns all variables from
the MAT file specified by filename
into the MATLAB® workspace.
load filename obj1 obj2 ...
returns the
instrument objects specified by obj1 obj2...
from the MAT file
filename
into the MATLAB workspace.
out = load('filename','obj1','obj2',...)
returns the specified instrument objects from the MAT file
filename
as a structure to out
instead of
directly loading them into the workspace. The field names in out
match the names of the loaded instrument objects.
Examples
Suppose you create the GPIB objects g1
and
g2
, configure a few properties for g1
, and
connect both objects to their associated instruments.
g1 = gpib('ni',0,1); g2 = gpib('ni',0,2); set(g1,'EOSMode','read','EOSCharCode','CR') fopen([g1 g2])
The read-only Status
property is automatically configured to
open
.
g1.Status ans = open
g2.Status ans = open
Save g1
and g2
to the file
MyObject.mat
, and then load the objects into the MATLAB workspace.
save MyObject g1 g2 load MyObject g1 g2
Values for read-only properties are restored to their default values upon loading, while all other property values are honored.
get([g1 g2],{'EOSMode','EOSCharCode','Status'}) ans = 'read' 'CR' 'closed' 'none' 'LF' 'closed'
Tips
Values for read-only properties are restored to their default values upon loading.
For example, the Status
property is restored to
closed
. To determine if a property is read-only, examine its
reference pages or use the propinfo
function.
Version History
Introduced before R2006a