Main Content

com.mathworks.toolbox.javabuilder.MWCharArray Class

Namespace: com.mathworks.toolbox.javabuilder

Java class to manage MATLAB character arrays

Description

Declaration

public class MWCharArray extends MWArray

Implemented Interfaces: Disposable, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

Creation

Constructors

MWCharArray()

Creates an empty char array.

MWCharArray(char val)

Constructs a new char array that represents the primitive char argument.

MWCharArray(java.lang.Object val)

Constructs a char array that represents the Object argument.

Properties

expand all

Public Properties

A convenient, efficient, and consistent way to represent an empty array as follows:

public static final MWArray EMPTY_ARRAY

Methods

expand all

Examples

collapse all

char[] chArray1 = {'H', 'e', 'l', 'l', 'o'};
char[] chArray2 = {'W', 'o', 'r', 'l', 'd'};
MWCharArray A = new MWCharArray(chArray1);
 
System.out.println("The string in MWCharArray1 is \"" + A + "\"");
 The string in MWCharArray1 is "Hello"

String str = new String(chArray2);
MWCharArray A2 = new MWCharArray(str);
 
System.out.println("The string in MWCharArray2 is \"" +
                         A2 + "\"");
The string in MWCharArray2 is "World"

Version History

Introduced in R2006a