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.


Character array from Automation server


IDL Method Signature

HRESULT GetCharArray([in] BSTR varName, [in] BSTR Workspace,  
[out, retval] BSTR *mlString)

Microsoft Visual Basic Client

GetCharArray(varname As String, workspace As String) As String


str = GetCharArray(h,'varname','workspace')


str = GetCharArray(h,'varname','workspace') gets the character array stored in varname from the specified workspace of the server attached to handle h and returns it in str. The values for workspace are base or global.

Visual Basic .NET Examples

This example uses a Visual Basic® .NET client. To run in products that execute VBA code, see Tips.

  1. Create the Visual Basic application. Use the MsgBox command to control flow between MATLAB® and the application.

    Dim Matlab As Object
    Dim S As String
    Matlab = CreateObject("matlab.application")
    MsgBox("In MATLAB, type" & vbCrLf _
        & "str='new text';")
        S = Matlab.GetCharArray("str", "base")
        MsgBox("str = " & S)
    Catch ex As Exception
        MsgBox("You did not set 'str' in MATLAB")
    End Try
  2. Open the MATLAB window, then type:

    str='new text';
  3. Click OK. The Visual Basic MsgBox displays what you typed in MATLAB.


  • To run examples in Microsoft® Office products that execute VBA code, replace the statement:

    MatLab = CreateObject("matlab.application")


    Set MatLab = CreateObject("matlab.application")

    If you need more information, then refer to your VBA product documentation.

Introduced before R2006a