This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
resources:eval:dpg:matlab [28 Nov 2012 21:21] Michael Fowler Corrected vector demo |
resources:eval:dpg:matlab [30 Jun 2016 17:21] John Birnie [Using MATLAB With the DPG] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Using MATLAB With the DPG ====== | ====== Using MATLAB With the DPG ====== | ||
- | + | This page describes using MATLAB with DPG2 and DPG3 pattern generators. For the ADS7 series of devices, see [[matlab-ads7|Using MATLAB with ADS7]] for information and code samples. | |
- | There are two methods that can be used to connect to a DPG from MATLAB. The second, newer method is more robust and can access all the features of a DPG. | + | |
===== MATLAB R2008b and Earlier ===== | ===== MATLAB R2008b and Earlier ===== | ||
To begin, use the MATLAB command actxserver to connect to the DPG Software Suite. | To begin, use the MATLAB command actxserver to connect to the DPG Software Suite. | ||
Line 20: | Line 18: | ||
</code> | </code> | ||
- | <note> | + | <WRAP round help> |
* MATLAB always sends its data as a 2D array (matrix). Even if you only have one column of data, you will still need to use the "2D" download vector commands. | * MATLAB always sends its data as a 2D array (matrix). Even if you only have one column of data, you will still need to use the "2D" download vector commands. | ||
* The "Int" integer format referenced in the [[Programming Reference]] is the same as the MATLAB data type int32. The "Double" data type is the same as MATLAB's type double. Most matrices in MATLAB are type double, unless specifically cast to a different data type. | * The "Int" integer format referenced in the [[Programming Reference]] is the same as the MATLAB data type int32. The "Double" data type is the same as MATLAB's type double. Most matrices in MATLAB are type double, unless specifically cast to a different data type. | ||
Line 26: | Line 24: | ||
* Be aware of any vector length restrictions for the particular pattern generator you are communicating to. For example, the length of a vector on the DPG2 must be divisible by 256. | * Be aware of any vector length restrictions for the particular pattern generator you are communicating to. For example, the length of a vector on the DPG2 must be divisible by 256. | ||
* The Interleaved commands take one vector and split it between the two output ports on the pattern generator. For single ports DACs which take interleaved data, you will need to interleave the channels before providing the data to the pattern generator. | * The Interleaved commands take one vector and split it between the two output ports on the pattern generator. For single ports DACs which take interleaved data, you will need to interleave the channels before providing the data to the pattern generator. | ||
- | </note> | + | </WRAP> |
==== Vector Downloading ==== | ==== Vector Downloading ==== | ||
Line 59: | Line 57: | ||
</code> | </code> | ||
- | <note>The index of //hardwarePlugins// corresponding to a particular hardware type could change if you ever update your DAC Software Suite. It is advisable to select the index of the //hardwarePlugins// array by querying the //FriendlyName// and selecting the one that has the correct name. | + | <WRAP round help>The index of //hardwarePlugins// corresponding to a particular hardware type could change if you ever update your DAC Software Suite. It is advisable to select the index of the //hardwarePlugins// array by querying the //FriendlyName// and selecting the one that has the correct name. |
- | </note> | + | </WRAP> |
==== Connect to a specific device ==== | ==== Connect to a specific device ==== |