Contents

PutCharArray

Store character array in Automation server

Synopsis

IDL Method Signature

PutCharArray([in] BSTR varname, [in] BSTR workspace, 
    [in] BSTR string)

Microsoft Visual Basic Client

PutCharArray(varname As String, workspace As String, 
    string As String)

MATLAB Client

PutCharArray(h,'varname','workspace','string')

Description

PutCharArray(h,'varname','workspace','string') stores the character array in string in the specified workspace of the server attached to handle h, assigning to it the variable varname. The values for workspace are base or global. The function name is case-sensitive.

Examples

Visual Basic .NET Client

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

Dim Matlab As Object
Try
    Matlab = GetObject(, "matlab.application")
Catch e As Exception
    Matlab = CreateObject("matlab.application")
End Try
MsgBox("MATLAB window created; now open it...")

Open the MATLAB window, then click Ok.

Matlab.PutCharArray("str", "base", _
       "He jests at scars that never felt a wound.")
MsgBox("In MATLAB, type" & vbCrLf _
  & "str")

In the MATLAB window type str; MATLAB displays:

str =
He jests at scars that never felt a wound.

Click Ok.

MsgBox("closing MATLAB window...")

Click Ok to close and terminate MATLAB.

Matlab.Quit()

More About

expand all

Tips

The character array specified in the string argument can have any dimensions. However, PutCharArray changes the dimensions to a 1–by-n column-wise representation, where n is the number of characters in the array. Executing the following commands in MATLAB illustrates this behavior:

h = actxserver('matlab.application');
chArr = ['abc'; 'def'; 'ghk']
chArr =
abc
def
ghk

PutCharArray(h,'Foo','base',chArr)
tstArr = GetCharArray(h,'Foo','base')
tstArr =
adgbehcfk 
Was this topic helpful?