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)
MicrosoftVisual BasicClient
GetFullMatrix(varname As String, workspace As String,
[out] XReal As Double, [out] XImag As Double
MATLABClient
[xreal ximag] = GetFullMatrix(h,'varname','
workspace
',zreal,zimag)
Description
[xreal ximag] = GetFullMatrix(h,'varname','
gets matrix stored in variableworkspace
',zreal,zimag)varname
from the specifiedworkspace
of the server attached to handleh
. The function returns the real part inxreal
and the imaginary part inximag
.The values forworkspace
arebase
orglobal
.
Thezreal
andzimag
arguments are matrices of the same size as the real and imaginary matrices (xreal
andximag
) returned from the server. Thezreal
andzimag
matrices are commonly set to zero.
UseGetFullMatrix
for 2D matrices with values of typedouble
only. UseGetVariable
orGetWorkspaceData
for other types. To use higher dimensional matrices, reshape the 2D matrix after receiving it from MATLAB®.
For VBScript clients, use theGetWorkspaceData
andPutWorkspaceData
functions to pass numeric data to and from the MATLAB workspace. These functions use thevariant
data type instead of thesafearray
data type used byGetFullMatrix
andPutFullMatrix
. VBScript does not supportsafearray
.
Examples
This example uses a Visual Basic®.NET client to read data from a MATLAB Automation server:
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)")
Open the MATLAB window and type:
M(3,4)
ClickOk.
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))
To close and terminate MATLAB, clickOk.