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 in Automation server workspace


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)




PutFullMatrix(h,'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 values for workspace are base or global.

The matrix cannot be a scalar, an empty array, or have more than two dimensions. To use higher dimensional matrices, reshape the matrix to a 2-D matrix before sending it to the MATLAB® server. Then change the dimensions back 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 safearray, which VBScript does not support.

Visual Basic .NET Examples

This example uses a Visual Basic® .NET client to write a matrix to the base workspace of the server. To run examples in products that execute VBA code, see Tips.

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")

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")
result = Matlab.Execute("whos global")


  • To run examples in Microsoft® Office products that execute VBA code, replace the statement:

    MatLab = CreateObject("matlab.application")


    Set MatLab = CreateObject("matlab.application")

    If you need more information, then refer to your VBA product documentation.

Introduced before R2006a