Main Content

GetFullMatrix

Matrix from Automation server workspace

Synopsis

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

MATLAB Client

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

Description

[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 2-D matrices with values of type double only. Use GetVariable or GetWorkspaceData for other types. To use higher dimensional matrices, reshape the 2-D 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.

Examples

collapse all

This example shows how to read a complex double matrix from a MATLAB Automation server.

type getfullmatrix.vba
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

Set MatLab = CreateObject("matlab.application")
Result = MatLab.Execute("M = rand(5);")
MsgBox("In MATLAB, type" & vbCrLf & "M(3,4)")
x = MatLab.GetFullMatrix("M", "base", XReal, XImag)
' Display element (3,4). The array in VBA
' is 0-based.
i = 2
j = 3
MsgBox("XReal(" & i + 1 & "," & j + 1 & ")" & _
    " = " & XReal(i, j))

This example shows how to read a complex double matrix from a MATLAB Automation server.

type getfullmatrix.vb
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)")
MatLab.GetFullMatrix("M", "base", XReal, XImag)
' Display element (3,4). The array in VB .NET
' is 0-based.
i = 2
j = 3
MsgBox("XReal(" & i + 1 & "," & j + 1 & ")" & _
    " = " & XReal(i, j))
Introduced before R2006a