라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.


Data from variable in Automation server workspace


IDL Method Signature

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

Microsoft Visual Basic Client

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


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


D = GetVariable(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.

Do not use GetVariable on sparse arrays, structures, or function handles.

If your scripting language requires a result be returned explicitly, use the GetVariable function in place of GetWorkspaceData, GetFullMatrix, or GetCharArray.


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

Dim Matlab As Object
Dim Result As String
Dim C2 As Variant
Matlab = CreateObject("matlab.application")
Result = Matlab.Execute("C1 = {25.72, 'hello', rand(4)};")
C2 = Matlab.GetVariable("C1", "base")
MsgBox("Second item in cell array: " & C2(0, 1))

Introduced before R2006a

Was this topic helpful?