icdevice
Create device object
Description
Use icdevice
to create a MATLAB® device object.
Creation
Syntax
Description
obj = icdevice(
creates the device object driver
,hwobj
)obj
. The instrument-specific information is
defined in the MATLAB interface instrument driver, driver
, which is specified
as a string. Communication to the instrument is done through the interface object,
hwobj
. The interface object can be a serial port, GPIB, VISA,
TCPIP, or UDP object. If driver
does not exist or if
hwobj
is invalid, the device object is not created.
Device objects may also be used with VXIplug&play and
Interchangeable Virtual Instrument (IVI®) drivers. To use these drivers, you must first have a MATLAB instrument driver wrapper for the underlying
VXIplug&play or IVI driver. If the MATLAB instrument driver wrapper does not already exist, it may be created using
makemid
or midedit
. Note that makemid
or midedit
only needs to be used once to create the MATLAB instrument driver wrapper.
obj = icdevice(
creates a device object driver
,rsrcname
)obj
, using the MATLAB instrument driver, driver
. The specified
driver
must be a MATLAB VXIplug&play instrument driver or MATLAB
IVI instrument driver and is specified as a string. Communication to the
instrument is done through the resource specified by rsrcname
as a
string. For example, all VXIplug&play, and many IVI drivers require VISA resource names for
rsrcname
.
obj = icdevice(
constructs a device
object driver
)obj
, using the MATLAB instrument driver, driver
. The specified
driver
must be a MATLAB
IVI instrument driver, and the underlying IVI driver must be referenced using a logical name.
obj = icdevice(___,
constructs a device object Name,Value
)obj
using one or more name-value arguments
in addition to the input arguments in previous syntaxes. The name-value arguments can be
in any format supported by the set
function: name-value character
vector pairs, structures, and name-value cell array pairs. You can also specify property
names without regard to case, and you can make use of property name completion. For
example, these commands are all valid and
equivalent:
d = icdevice('tektronix_tds210',g,'ObjectVisibility','on'); d = icdevice('tektronix_tds210',g,'objectvisibility','on'); d = icdevice('tektronix_tds210',g,'ObjectVis','on');
Note
When deploying code using IVI-C or VXIplug&play drivers, executing your code will generate additional file(s) in the folder specified by executing the following code at the MATLAB prompt:
fullfile(tempdir,'ICTDeploymentFiles',sprintf('R%s',version('-release')))
On all supported platforms, a file with the name
MATLABPrototypeFor<driverName>.m
is generated, where
<driverName>
the name of the IVI-C or
VXIplug&play driver. With 64-bit MATLAB on Windows®, a second file by the name
<driverName>_thunk_pcwin64.dll
is generated. When creating your
deployed application or shared library, manually include these generated files. If using
the icdevice
function, remember to also manually include the MDD-file
in the deployed application or shared library. For more information on including
additional files refer to the MATLAB
Compiler™ documentation.
Examples
Tips
At any time, you can use the instrhelp
function to view a complete
listing of properties and functions associated with device objects.
instrhelp icdevice
When you create a device object, these property values are automatically configured:
Interface
specifies the interface used to communicate with the instrument. For device objects created using interface objects, it is that interface object. For VXIplug&play and IVI-C, this is the session handle to the driver session. For MATLAB instrument drivers, this is the handle to the driver's default COM interface.LogicalName
is an IVI logical name. For non-IVI drivers, it is empty.Name
is given by concatenating the instrument type with the name of the instrument driver.RsrcName
is the full VISA resource name for VXIplug&play and IVI drivers. For MATLAB interface drivers,RsrcName
is an empty character vector.Type
is the instrument type, if known (for example,scope
ormultimeter
).
To communicate with the instrument, the device object must be connected to the instrument
with the connect
function. When the device object is
constructed, the object's Status
property is closed
.
Once the device object is connected to the instrument with the connect
function, the Status
property is configured to
open
.
Note
ICDEVICE is unable to open MDDs with non-ascii characters either in their name or path on Mac platforms.
Note
To get a list of options you can use on a function, press the Tab key after entering a function on the MATLAB command line. The list expands, and you can scroll to choose a property or value. For information about using this advanced tab completion feature, see Using Tab Completion for Functions.
Version History
Introduced before R2006a