GetFullMatrix - Get matrix from server

Synopsis

MATLAB® Client

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

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

Description

GetFullMatrix gets the matrix stored in the variable varname from the specified workspace of the server attached to handle h and returns the real part in xreal and the imaginary part in ximag. The workspace argument can be either base or global.

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

Remarks

If you want output from GetFullMatrix to be displayed at the client window, you must specify one or both output variables (e.g., xreal and/or ximag).

Server function names, like GetFullMatrix, are case sensitive when using the first syntax shown.

There is no difference in the operation of the three syntaxes shown above for the MATLAB® client.

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 safearray, which is not supported by VBScript.

Examples

Assign a 5-by-5 real matrix to the variable M in the base workspace of the server, and then read it back with GetFullMatrix.

MATLAB® Client

h = actxserver('matlab.application');
h.PutFullMatrix('M','base',rand(5),zeros(5));

MReal = h.GetFullMatrix('M','base',zeros(5),zeros(5))
MReal =
    0.9501    0.7621    0.6154    0.4057    0.0579
    0.2311    0.4565    0.7919    0.9355    0.3529
    0.6068    0.0185    0.9218    0.9169    0.8132
    0.4860    0.8214    0.7382    0.4103    0.0099
    0.8913    0.4447    0.1763    0.8936    0.1389

Visual Basic® .NET Client

This example uses the Visual Basic® MsgBox command to control flow between MATLAB and the Visual Basic Client.

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)

Click Ok.

MatLab.GetFullMatrix("M", "base", XReal, XImag)
i = 2   %0-based array
j = 3

MsgBox("XReal(" & i + 1 & "," & j + 1 & ")" & _
       " = " & XReal(i, j))

Click Ok to close and terminate MATLAB.

See Also

PutFullMatrix, GetWorkspaceData, PutWorkspaceData, GetVariable, Execute

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS