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.


Data from Automation server workspace


IDL Method Signature

HRESULT GetWorkspaceData([in] BSTR varname, [in] BSTR workspace, 
[out] VARIANT* pdata)

Microsoft Visual Basic Client

GetWorkspaceData(varname As String, workspace As String) As Object


D = GetWorkspaceData(h,'varname','workspace')


D = GetWorkspaceData(h,'varname','workspace') gets data stored in variable varname from the specified workspace of the server attached to handle h and returns it in output argument D. The values for workspace are base or global. Use this syntax when writing VBA code.

Use GetWorkspaceData instead of GetFullMatrix and GetCharArray to get numeric and character array data, respectively. Do not use GetWorkspaceData on sparse arrays, structures, or function handles.

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 the safearray data type used by GetFullMatrix and PutFullMatrix. VBScript does not support safearray.


collapse all

This example shows how to use a Visual Basic® .NET client to read data from a MATLAB Automation server.

type getworkspacedata.vb
Dim Matlab As Object
Dim C2 As Object
Dim Result As String
Matlab = CreateObject("matlab.application")
Result = MatLab.Execute("C1 = {25.72, 'hello', rand(4)};")
MsgBox("In MATLAB, type" & vbCrLf & "C1")
Matlab.GetWorkspaceData("C1", "base", C2)
MsgBox("second value of C1 = " & C2(0, 1))

Introduced before R2006a