Download Now | Pricing / Purchase 

DADiSP 6.5 B05 Release Notes

MATLAB Code Execution Module


MATLINK runs MATLAB programs directly from DADiSP and exchanges data between DADiSP and MATLAB. Both built-in and custom MATLAB functions or scripts are executed just as if they were native DADiSP functions. MATLINK Code Execution Module

Arrays, scalar and string data are exchanged transparently in fast binary format using the ActiveX Automation interfaces of DADiSP and MATLAB.

How Does It Work?


The key to the simplicity and power of MATLINK resides in the MATLAB Object created by DADiSP. The MATLAB Object supports the execution of any MATLAB expression from the MATLAB environment and returns the results to DADiSP via ActiveX. Because the code is still run in MATLAB, the results are exactly the same as would normally be produced by MATLAB.

ML Dot Syntax


The default name of the MATLAB Object is ml. Simply preface the original MATLAB function name with ml. to run any MATLAB code from DADiSP. For example, the following DADiSP command displays the current version of the available MATLAB release:


  ml.version

The returned version text is displayed by DADiSP. Because the connection to MATLAB is automatically established when the MATLAB Object is first invoked, explicit initialization is not required.

Mix and Match


DADiSP and MATLAB functions can be combined and used interchangeably within a Worksheet or SPL functions. For example:


  W1: gnorm(10000, 1)
  W2: ml.diff(W1)

W1 contains 1000 samples of Gaussian distributed random noise. The data is then processed by the MATLAB diff function and displayed in W2. When W1 changes, W2 automatically updates and the new data is processed by MATLAB.

The MATLAB diff function executes just like any other DADiSP function except
  1. DADiSP sends the required data to MATLAB.
  2. MATLAB executes the function.
  3. The results are returned to DADiSP.
The entire process is perfomed automatically, transparently and efficiently.

DADiSP and MATLAB functions can be freely mixed. For example:


  W1: gnorm(10000, 1)
  W2: movavg(ml.diff(w1), 10)

The MATLAB diff function is applied to the data in W1 and the result is smoothed by means of a 10 point moving average computed by the DADiSP movavg function. Any combination of DADiSP and MATLAB functions can be combined in this manner.

Data Exchange


Although generally not required, MATLINK supports explicit data exchange between DADiSP and MATLAB variables. For example:


  // assign a DADiSP series to a MATLAB variable
  ml.MatVar = 1..100;

  // return a MATLAB variable to DADiSP and process
  x = 10 * ml.MatVar;

The MATLAB variable MatVar is created and assigned a series of values from 1 to 100. The DADiSP variable x contains the value of the MATLAB variable multiplied by 10. Though required data transfers are automatically handled by the MATLAB Object, the "dot syntax" provides a natural method for exchanging program variables when desired.

MATLAB Command Prompt


MATLAB expressions in original MATLAB syntax are evaluated directly by using the > prompt.


  W1: >1:100
  W2: integ(W1)

W1 contains the values 1 through 100 as produced by the MATLAB expression 1:100. W2 integrates the data. Again, a change to W1 automatically updates W2.

Although the equivalent data in W1 can be generated natively by DADiSP with the statement 1..100, the expression 1:100 is standard MATLAB syntax. Any expression in standard MATLAB syntax is supported and evaluated when the expression is prefaced by the > prompt.

Additional Features


The mlhelp function displays the original help text for MATLAB functions. For example:


  mlhelp eig

The standard help information for the MATLAB eig function is displayed in DADiSP.

The mldoc function displays the online documentation for MATLAB functions. For example:


  mldoc fft

The online documentation for the MATLAB fft function is displayed in DADiSP.

Multiple return values from MATLAB functions is supported.


  W1: rand(10)
  W2: (v, d) = ml.eig(W1);d

The MATLAB eig function returns two arrays. The second array, a diagonal matrix of eigenvalues, is placed and dislayed in W2.

Error messages or warnings produced by MATLAB are displayed in DADiSP. Functions that produce textual results are presented in a pop-up dialog box. For example, to display a list of currently available MATLAB variables with corresponding data types:


  ml.whos


The mlshow function displays or hides the MATLAB automation server.


  mlshow(1)

displays the MATLAB automation server user interface.

Requirements


MATLINK requires a licensed copy of MATLAB Version 4.0 or higher to be available from the machine running DADiSP.



 New Functions | GUI Enhancements