com.mathworks.toolbox.javabuilder.MWStringArray Class
Namespace: com.mathworks.toolbox.javabuilder
Java class to manage MATLAB string arrays
Description
Declaration
public class MWStringArray extends MWArray
The MWStringArray class manages a native MATLAB® string array
Implemented Interfaces: Disposable
,
java.io.Serializable
, java.lang.Cloneable
,
java.lang.Comparable
Creation
MWStringArray()
Creates an empty string array.
MWStringArray(int[] dims)
Creates an n-dimensional string array with all elements in default value.
MWStringArray(java.lang.String val)
Creates a one-element string array that represents the java string argument.
MWStringArray(java.lang.String[] vals)
Creates a string array that represents the java String[] argument.
Properties
Public Properties
A convenient, efficient, and consistent way to represent an empty array as follows:
public static final MWArray EMPTY_ARRAY
Methods
applyVisitor |
This
method is abstract and returns a type specified by the type parameter <T>.
It takes an instance of Parameters:
Returns:
|
classID |
Returns the MATLAB type of this array. Example: Getting the Class ID of a String Array Create an MWStringArray object and then display the class ID: MWStringArray A = new MWStringArray("Hello"); System.out.println("The class of A is " + A.classID()); The class of A is string Returns: MWClassID of this array. |
clone |
Creates and returns a deep copy of this array. Changing the data in a deep copy does not change the original array. Example: Cloning a String Array Object Create a clone of MWStringArray object A as follows: MWStringArray A = new MWStringArray("Hello"); MWStringArray C = (MWStringArray)A.clone(); System.out.println("Clone of matrix A is:"); System.out.println(C.get(1)); Clone of matrix A is: Hello Returns: An MWStringArray instance representing a deep copy of the underlying MATLAB array. Throws:
|
columnIndex |
Returns an array containing the column index of each element in the underlying MATLAB array. Specified by:
Returns: Array of indices. |
compareTo |
Compares this array with the specified array for order. Specified by:
Specified by:
Parameters:
|
deserialize |
Create a new MWArray from serialized data. Parameters:
Returns: The deserialized MWArray. |
dispose |
Frees the native MATLAB array contained by this array. Specified by:
Specified by:
|
equals |
Indicates whether some other array is equal to this one. Specified by:
Parameters:
|
get |
Returns the string at the specified 1-based offset. Parameters:
Returns: Value of the requested element. Null if the element is unset. Throws:
|
get |
Returns the string at the specified indices. Parameters:
Returns: Value of the requested element. Null if the element is unset. Throws:
|
getData |
Returns a 1-D string array containing a copy of the data in the underlying MATLAB array. Returns: A 1-D
string array of elements stored in column-wise order. The length of the returned
array equals |
getDimensions |
Returns an array containing the size of each dimension of this array. Parameters:
Returns: An Array of dimension sizes. Throws:
|
hashCode |
Returns a hash code value for this array. Specified
by:
|
isEmpty |
Tests if this array has no elements. Specified by:
Returns:
|
IsMissingElement |
Checks if the element at the specified 1-based offset of this array has the value "missing". Parameters:
Returns: A boolean to indicate if the requested element is in missing/unset state. Throws:
|
IsMissingElement |
Checks if the element at the specified indices of this array has the value "missing". Parameters:
Returns: A boolean to indicate if the requested element is in missing/unset state. Throws:
|
isSparse |
Tests if this array is sparse. Specified by:
Returns:
|
maximumNonZeros |
Returns the
allocated capacity of an array. If the underlying array is non-sparse, this method
returns the same value as
Returns: Currently allocated number of non-zero elements. |
newInstance |
Constructs a string array with the specified dimensions. The elements of the array are all initialized to the default. Parameters:
Returns: A new MWStringArray with the specified dimensions. Throws:
|
numberOfDimensions |
Returns the number of dimensions of this array. Returns: The number of dimensions. Throws:
|
numberOfElements |
Returns the number of elements of this array. Returns: The number of elements. Throws:
|
numberOfNonZeros |
Returns the number of non-zero elements in an array. If the
underlying array is non-sparse, this method returns the same value as
Returns: Current number of non-zero elements. |
readResolve |
Called by serialization mechanism when loading a new array from a byte stream. This method validates the correct array type. Returns: Returns this Object indicating validated array type. Throws:
|
rowIndex |
Returns an array containing the row index of each element in the underlying MATLAB array. Specified by:
Returns: Array of indices. |
serialize |
Serialize the MATLAB array to a byte array. Returns: The serialized MATLAB array data. Throws:
|
set |
Replaces the string at the specified 1-based offset in this array with the specified string value. Parameters:
Throws:
|
set |
Replaces the string at the specified indices in this array with the specified string value. Parameters:
Throws:
|
setData |
Sets the elements of this array in column-major order until the input strings are all consumed or all elements of this array are updated, whichever comes first. Parameters:
Returns: Throws:
|
sharedCopy |
Creates and returns a shared copy of this array. A shared copy points to the same underlying MATLAB array as the original. Changing the data in a shared copy also changes the original array. Example: Making a Shared Copy of a String Array Object Create a shared copy of MWStringArray object A as follows: MWStringArray A = new MWStringArray("Hello"); MWStringArray S = (MWStringArray)A.sharedCopy(); System.out.print("Shared copy of matrix A is \"" + S.get(1) + "\""); Shared copy of matrix A is "Hello" Returns: An MWStringArray instance representing a shared copy of the underlying MATLAB array. |
toArray |
Returns a 1-D string array containing a copy of the data in the underlying MATLAB array. Returns: A 1-D
string array of elements stored in column-wise order. The length of the returned
array equals |
toString |
Returns a string representation of this array. Returns: null for empty array or string in the form of
|
validate |
Validates the internal array handle. Called by constructors and deserialization code. |
Methods inherited from class
com.mathworks.toolbox.javabuilder.MWArray
.
disposeArray |
This
method destroys any native MATLAB arrays contained in the input object and frees the memory occupied
by them. This is a static method of the class and thus does not need to be invoked
in reference to an instance of the class. If the input object implements the
Example: Constructing an MWNumericArray Object MWArray[] MArr = new MWArray[10]; for (int i = 0; i < 10; i++) MArr[i] = new MWNumericArray(); MWArray.disposeArray(MArr); Parameters:
|
Methods inherited from class java.lang.Object
.
finalize |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
getClass |
Returns the runtime class of this Object. |
notify |
|
notifyAll |
Wakes up all threads that are waiting on this object's monitor. |
wait |
Causes
the current thread to wait until another thread invokes the
|
Version History
Introduced in R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)