This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Matrix from Automation server workspace


IDL Method Signature

GetFullMatrix([in] BSTR varname, [in] BSTR workspace, 
[in, out] SAFEARRAY(double) *pr, [in, out] SAFEARRAY(double) *pi)

Microsoft Visual Basic Client

GetFullMatrix(varname As String, workspace As String, 
[out] XReal As Double, [out] XImag As Double


[xreal ximag] = GetFullMatrix(h,'varname','workspace',zreal,zimag)


[xreal ximag] = GetFullMatrix(h,'varname','workspace',zreal,zimag) gets matrix stored in variable varname from the specified workspace of the server attached to handle h. The function returns the real part in xreal and the imaginary part in ximag. The values for workspace are base or global.

The zreal and zimag arguments are matrices of the same size as the real and imaginary matrices (xreal and ximag) returned from the server. The zreal and zimag matrices are commonly set to zero.

Use GetFullMatrix for 2D matrices with values of type double only. Use GetVariable or GetWorkspaceData for other types. To use higher dimensional matrices, reshape the 2D matrix after receiving it from MATLAB®.

For VBScript clients, use the GetWorkspaceData and PutWorkspaceData functions to pass numeric data to and from the MATLAB workspace. These functions use the variant data type instead of the safearray data type used by GetFullMatrix and PutFullMatrix. VBScript does not support safearray.


This example uses a Visual Basic® .NET client to read data from a MATLAB Automation server:

  1. Create the Visual Basic application. To control flow between MATLAB and the application, use the MsgBox command.

    Dim MatLab As Object
    Dim Result As String
    Dim XReal(4, 4) As Double
    Dim XImag(4, 4) As Double
    Dim i, j As Integer
    MatLab = CreateObject("matlab.application")
    Result = MatLab.Execute("M = rand(5);")
    MsgBox("In MATLAB, type" & vbCrLf _
        & "M(3,4)")
  2. Open the MATLAB window and type:

  3. Click Ok.

  4. In the Visual Basic application:

    MatLab.GetFullMatrix("M", "base", XReal, XImag)
    i = 2   %0-based array
    j = 3
    MsgBox("XReal(" & i + 1 & "," & j + 1 & ")" & _
        " = " & XReal(i, j))
  5. To close and terminate MATLAB, click Ok.

Introduced before R2006a

Was this topic helpful?