Main Content

GetCharArray

Character array from Automation server

Synopsis

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

MATLAB Client

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

Description

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.

Examples

expand all

This example shows how to pass character data between MATLAB® and a Visual Basic® .NET client. Create an application with the following code.

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

Open the MATLAB window, then type:

str='new text';

Click OK. The Visual Basic MsgBox command displays what you typed in MATLAB.

This example shows how to pass character data between MATLAB® and a VBA client. Create an application with the following code.

type getchararray.vba
Dim Matlab As Object
Dim S As String
Set Matlab = CreateObject("matlab.application")
MsgBox("In MATLAB, type" & vbCrLf & "str='new text';")
S = Matlab.GetCharArray("str", "base")
MsgBox("str = " & S)

Open the MATLAB window, then type:

str='new text';

Click OK. The VBA MsgBox command displays what you typed in MATLAB.

Version History

Introduced before R2006a