Saving Your Test
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
tektronix_tds210_ex_test.m. Then you
execute the test from the MATLAB Command Window by typing
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
at the bottom of the dialog box reflects that name. You use that
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.
drivertestin the Specify the driver function name field.
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 (
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
drivertestfunction saved in it.
obj = icdevice('tektronix_tds210_ex.mdd',g)
Connect to the device.
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])