Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

PutFullMatrix - Matrix in Automation server workspace

Synopsis

MATLAB Client

h.PutFullMatrix('varname', 'workspace', xreal, ximag)
PutFullMatrix(h, 'varname', 'workspace', xreal, ximag)

IDL Method Signature

PutFullMatrix([in] BSTR varname, [in] BSTR workspace, [in] SAFEARRAY(double) xreal, [in] SAFEARRAY(double) ximag)

Microsoft Visual Basic Client

PutFullMatrix([in] varname As String, [in] workspace As String, [in] xreal As Double, [in] ximag As Double)

Description

h.PutFullMatrix('varname', 'workspace', xreal, ximag) stores a matrix in the specified workspace of the server attached to handle h and assigns it to variable varname. Use xreal and ximag for the real and imaginary parts of the matrix. The matrix cannot be a scalar, an empty array, or have more than two dimensions. The values for workspace are base or global.

PutFullMatrix(h, 'varname', 'workspace', xreal, ximag) is an alternate syntax.

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

Use a MATLAB client to write a matrix to the base workspace of the server:

h = actxserver('matlab.application');
h.PutFullMatrix('M', 'base', rand(5), zeros(5))
%Use one output for real values only
xreal = h.GetFullMatrix('M', 'base', zeros(5), zeros(5))
 

Use a Visual Basic .NET client to write a matrix to the base workspace of the server:

Dim MatLab As Object
Dim XReal(4, 4) As Double
Dim XImag(4, 4) As Double
Dim ZReal(4, 4) As Double
Dim ZImag(4, 4) As Double
Dim i, j As Integer

For i = 0 To 4
   For j = 0 To 4
   XReal(i, j)  = Rnd() * 6
   XImag(i, j) = 0
   Next j
Next i

Matlab = CreateObject("matlab.application")
MatLab.PutFullMatrix("M", "base", XReal, XImag)
MatLab.GetFullMatrix("M", "base", ZReal, ZImag)
 

Use a MATLAB client to write a matrix to the global workspace of the server:

h = actxserver('matlab.application');
h.PutFullMatrix('X', 'global', [1 3 5; 2 4 6], ...
    [1 1 1; 1 1 1])
h.invoke('Execute', 'whos global')
 

Use a Visual Basic .NET client to write a matrix to the global workspace of the server:

Dim MatLab As Object
Dim XReal(1, 2) As Double
Dim XImag(1, 2) As Double
Dim result As String
Dim i, j As Integer

For i = 0 To 1
	For j = 0 To 2
		XReal(i, j) = (j * 2 + 1) + i
		XImag(i, j) = 1
	Next j
Next i

Matlab = CreateObject("matlab.application")
MatLab.PutFullMatrix("X", "global", XReal, XImag)
result = Matlab.Execute("whos global")
MsgBox(result)

See Also

Execute | GetFullMatrix | PutWorkspaceData

How To

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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