Matlab

 

Contents

Name

Matlab

Remark

Matlab class provides communication between Origin and Matlab.

Hierarchy

Examples

EX1

#include <origin.h>
#include <externApps.h> // this file is not included in origin.h
////////////////////////////////////////////////////////////////////////////////////

void mltest()
{
    Matlab matObj(true);
    if(!matObj)
    {
        out_str("No Matlab found");
        return;
    }
    
    //defines 3x5 matrix named ma
    string strRet = matObj.Execute("ma=[1 2 3 4 5; 4 5 6 7 8;10.3 4.5 -4.7 -23.2 -6.7]");    
    out_str(strRet);// show str from Matlab
    
    // put matrix into Origin matrix
    MatrixLayer matLayer;
    matLayer.Create();
    Matrix mao(matLayer);
    
    //Transfer Matlab's matrix (ma) to Origin's mao matrix.
    BOOL bRet = matObj.GetMatrix("ma", &mao);
}

header to Include

ExternApps.h

Reference

Members

Name Brief Example
Attach Establishes connection to Matlab. Examples
Detach Destroys the connection with Matlab Examples
Execute Executes command in Matlab workspace Examples
GetMatrix Transfer Matlab matrix to Origin Matrix. OriginC matrix not currently supported. Examples
GetString Transfer Matlab character array to Origin string. Examples
Matlab Constructor for Matlab class. Examples
MinimizeCommandWindow Minimizes Matlab command window. Examples
PutMatrix Transfer Origin Matrix to Matlab matrix. OriginC matrix not currently supported. Complex matrices not currently supported Examples
PutString Transfer Origin string to Matlab character array. Examples

Property

Name Brief Example
KeepMatlabRunning Controls if Origin should keep Matlab session alive after closing the connection. When Origin exits, Matlab session created by Origin, or Matlab session started prior to Origin one, with command line: Matlab /Automation, will close. Examples
Visible Shows the Visible/Hidden state of Matlab window. Examples