Main Content

PutWorkspaceData

Data in Automation server workspace

Synopsis

IDL Method Signature

PutWorkspaceData([in] BSTR varname, [in] BSTR workspace, [in] VARIANT data)

MicrosoftVisual BasicClient

PutWorkspaceData(varname As String, workspace As String, data As Object)

MATLABClient

PutWorkspaceData(h,'varname','workspace',data)

Description

PutWorkspaceData(h,'varname','workspace',data)storesdatain theworkspaceof the server attached to handlehand assigns it tovarname.The values forworkspacearebaseorglobal.

UsePutWorkspaceDatato pass numeric and character array data respectively to the server. DonotusePutWorkspaceDataon sparse arrays, structures, or function handles. Use theExecutemethod for these data types.

TheGetWorkspaceDataandPutWorkspaceDatafunctions pass numeric data as avariantdata type. These functions are especially useful for VBScript clients as VBScript does not support thesafearraydata type used byGetFullMatrixandPutFullMatrix.

Examples

expand all

This example creates an array in a Visual Basic .NET application and displays it in MATLAB.

Create a Visual Basic .NET client with the following code.

typeputworkspacedata.vb
Dim Matlab As Object Dim data(6) As Double Dim i As Integer Matlab = CreateObject("matlab.application") For i = 0 To 6 data(i) = i * 15 Next i Matlab.PutWorkspaceData("A", "base", data) MsgBox("In MATLAB, type" & vbCrLf & "A")

This example creates an array in a VBA application and displays it in MATLAB.

Create a VBA client with the following code.

typeputworkspacedata.vba
Dim Matlab As Object Dim data(6) As Double Dim i As Integer Set Matlab = CreateObject("matlab.application") For i = 0 To 6 data(i) = i * 15 Next i Matlab.PutWorkspaceData("A", "base", data) MsgBox("In MATLAB, type" & vbCrLf & "A")

Version History

Introduced before R2006a