MATLAB: How to create and use a MATLAB Instrument Driver (.mdd) file for use with the Agilent MXA/EXA or PSA series Signal/Spectrum Analyzer

comexaInstrument Control Toolboxivimddmxapersonality

I am using the Instrument Control Toolbox in MATLAB to communicate with and control an Agilent X Series Signal Analyzer (MXA/EXA) or a PSA series Spectrum Analyzer. I have installed the appropriate Agilent IVI-COM drivers for this series of instruments. I am trying to create a MATLAB Instrument Driver (.mdd) file in order to control the instrument through an interface object.
When using the MAKEMID command to do this, I receive the following error:
??? Error using ==> makemid at 136
Error using ==> privateDeviceConstructorHelper>localProgramIdFromLogicalName at 116
The specified logical name references an invalid or incomplete driver session.

Best Answer

The IVI-COM drivers for the Agilent MXA/EXA series of Signal Analyzers and PSA series of Spectrum Analyzers implement special interfaces known as Measurement Personalities. The ability to create a MATLAB Instrument Driver (.mdd) file from an IVI-COM driver that implements personalities is not available in Instrument Control Toolbox 2.7 (R2008b).
To work around this issue, follow these steps:
(1) Visit the following Agilent webpage:
Download the file linked at the bottom of the page labeled "Supported MATLAB driver for EXA, MXA, and PSA", and save it as an MDD (.mdd) file in your working directory.
(2) Create an instrument object using the ICDEVICE command:
% hwobj is an interface object you have successfully created
d = icdevice('<mdd_file_name>.mdd', hwobj)
or
% RsrcName is a VISA resource name/string
d = icdevice('<mdd_file_name>.mdd', 'RsrcName');
(3) If instrument object creation is successful, query for the instrument ID by issuing the following command in MATLAB:
>> get(d,'Identify')
Where 'Identify' is a property of the instrument object as defined by the MDD file, and wraps around the "*IDN?" command. To browse the MDD file for a complete list of Properties and Functions as defined by the instrument driver, you can issue the following command:
>> midedit('E4440A.mdd');
(4) Download the materials linked on the same Agilent webpage. They can be downloaded via the link labeled "MATLAB technical kit..." at the bottom of the webpage. Explore these examples to proceed to further use MATLAB with your Agilent instrument.