Matlab::Execute

Description

Executes command in Matlab workspace

Syntax

string Execute( LPCSTR lpcszCommand )

BOOL Execute( LPCSTR lpcszCommand, string & strReturn )

Parameters

lpcszCommand
[input] Matlab command to execute.
strReturn
[output] string to receive Matlab output,or Origin C output "??? FAILED TO EXECUTE MAtlab" if execution failed

Return

Returns the string containing Matlab command window output.

//Comment: ";" at the end of the command suppresses output in Matlab.


Returns TRUE on successful exit and FALSE on error.

Examples

EX1

#include <ExternApps.h>
void Matlab_Execute_ex1()
{
        Matlab matObj(true);
        if(!matObj)
        {
                out_str("No Matlab found !!!!!");
                return;
        }
        string strRet1 = matObj.Execute("ma=[1 2 3; 4 5 6]");    //defines 2x3 matrix named ma
        out_str(strRet1);
}

Remark

See Also

header to Include

ExternApps.h