Skip to Main Content Skip to Search
Product Documentation

GetWorkspaceData - Data from Automation server workspace

Synopsis

MATLAB Client

D = h.GetWorkspaceData('varname','workspace')
D = GetWorkspaceData(h,'varname','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

Description

D = h.GetWorkspaceData('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.

D = GetWorkspaceData(h,'varname','workspace') is an alternate syntax.

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.

Examples

This example uses a MATLAB client to read data from a MATLAB Automation server:

%Create the MATLAB server
h = actxserver('matlab.application');
%Create cell array C1 in the base workspace of the server
h.PutWorkspaceData('C1', 'base', ...
    {25.72, 'hello', rand(4)});
C2 = h.GetWorkspaceData('C1', 'base')
 

This example uses a Visual Basic .NET client to read data from a MATLAB Automation server:

Dim Matlab As Object
Dim C2 As Variant
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))

See Also

Execute | GetCharArray | GetFullMatrix | GetVariable | PutWorkspaceData

How To

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS