Saving Your Test
Note
The MATLAB® instrument driver functions makemid
,
midedit
, and midtest
will be removed
in a future release. Use the ividev
interface from the Instrument Control Toolbox™ Support Package for
IVI® and VXIplug&play Drivers instead. For more information, see IVI and VXIplug&play Drivers.
Saving the Test as MATLAB Code
In the preceding examples of this chapter, you have been saving the test file after creating each step. The test file is saved in XML format. Here are some other save options.
You save the test file as MATLAB code by clicking the File menu and selecting Save Test as M-Code.
You can execute the test by calling this file from the MATLAB Command Window.
For example, you can save the test file you created in this
chapter as tektronix_tds210_ex_test.m
. Then you
execute the test from the MATLAB Command Window by typing
tektronix_tds210_ex_test
The test results are displayed in the MATLAB Command Window.
Saving the Test as a Driver Function
You save your test as a driver function by clicking the File menu and selecting Save Test as Driver Function.
When you enter a name for the driver test function, the invoke
command
at the bottom of the dialog box reflects that name. You use that invoke
command
to execute the driver function from the MATLAB Command Window
or in a file.
Creating a Driver Test Function
Click the File menu and select Save Test as Driver Function.
Enter
drivertest
in the Specify the driver function name field.Click OK.
A function called drivertest
is created
and saved as part of the instrument driver file. You can open the
driver file in the MATLAB Instrument Driver Editor tool (midedit
)
to verify that the drivertest
function is included.
Calling a Driver Test Function from the MATLAB Command Window
Now that the test function is included in the driver, you access
it with the invoke
command from MATLAB.
In the MATLAB Command Window,
Create an interface object.
g = gpib('cec',0,4)
Create a device object, specifying the driver with the
drivertest
function saved in it.obj = icdevice('tektronix_tds210_ex.mdd',g)
Connect to the device.
connect(obj)
Execute the driver test.
out = invoke(obj, 'drivertest')
When the test is complete, disconnect from the instrument and delete the objects.
disconnect(obj) delete ([g obj])