Main Content

GetFullMatrix

来自自动化服务器工作区的矩阵

大纲

IDL 方法签名

GetFullMatrix([in] BSTR varname, [in] BSTR workspace,
    [in, out] SAFEARRAY(double) *pr, [in, out] SAFEARRAY(double) *pi)

Microsoft Visual Basic 客户端

GetFullMatrix(varname As String, workspace As String,
    [out] XReal As Double, [out] XImag As Double

MATLAB 客户端

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

描述

[xreal ximag] = GetFullMatrix(h,'varname','workspace',zreal,zimag) 从附加到句柄 h 的服务器的指定 workspace 获取存储在变量 varname 中的矩阵。该函数在 xreal 中返回实部,在 ximag 中返回虚部。workspace 的值为 baseglobal

zrealzimag 参数是大小与服务器返回的实矩阵和虚矩阵(xrealximag)相同的矩阵。zrealzimag 矩阵通常设置为零。

GetFullMatrix 只适用于值类型为 double 的二维矩阵。将 GetVariableGetWorkspaceData 用于其他类型。要使用更高维度的矩阵,需要在从 MATLAB® 接收二维矩阵后对其进行重构。

对于 VBScript 客户端,使用 GetWorkspaceDataPutWorkspaceData 函数向 MATLAB 工作区传递数值数据和从该工作区传出数值数据。这些函数使用 variant 数据类型而非 GetFullMatrixPutFullMatrix 使用的 safearray 数据类型。VBScript 不支持 safearray

示例

全部展开

此示例说明如何从 MATLAB 自动化服务器中读取复数双精度矩阵。

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

此示例说明如何从 MATLAB 自动化服务器中读取复数双精度矩阵。

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

版本历史记录

在 R2006a 之前推出