GetWorkspaceData - Get data from server workspace

Synopsis

MATLAB Client

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

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

GetWorkspaceData gets the data stored in the variable varname from the specified workspace of the server attached to handle h and returns it in output argument D. The workspace argument can be either base or global.

Remarks

You can use GetWorkspaceData in place of GetFullMatrix and GetCharArray to get numeric and character array data respectively.

If you want output from GetWorkspaceData to be displayed at the client window, you must specify an output variable.

Server function names, like GetWorkspaceData, are case sensitive when using the first syntax shown.

There is no difference in the operation of the three syntaxes shown above for the MATLAB client.

The GetWorkspaceData and PutWorkspaceData functions pass numeric data as a variant data type. These functions are especially useful for VBScript clients as VBScript does not support the safearray data type used by GetFullMatrix and PutFullMatrix.

Examples

Assign a cell array to variable C1 in the base workspace of the server, and then read it back with GetWorkspaceData.

MATLAB Client

h = actxserver('matlab.application');
h.PutWorkspaceData('C1', 'base', ...
                   {25.72, 'hello', rand(4)});
C2 = h.GetWorkspaceData('C1', 'base')

C2 = 
    [25.7200]    'hello'    [4x4 double]

Visual Basic .NET Client

This example uses the Visual Basic MsgBox command to control flow between MATLAB and the Visual Basic Client.

Dim Matlab, 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))

See Also

PutWorkspaceData, GetFullMatrix, PutFullMatrix, GetCharArray, PutCharArray, GetVariable, Execute

  


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