public class MWCellArray extends MWArray implements java.io.Serializable
MWCellArray
class manages a native MATLAB cell array.
This class does not depend on MATLAB Runtime and should only be used in a Java RMI based
application where the client machine does not have MATLAB Runtime installed.Constructor and Description |
---|
MWCellArray()
Creates an empty cell array.
|
MWCellArray(int[] inDims)
Constructs a new cell array with the specified dimensions.
|
MWCellArray(int rows,
int cols)
Constructs a new cell matrix with the specified number of rows and columns.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Returns true if the input Object is of type MWCellArray and has equal elements.
|
java.lang.String |
toString()
This method returns a string representation of the array.
|
get, get, getData, getDimensions, getDimsStr, getMaxValidIndex, getOneBasedIndexForArray, hashCode, initNativeArray, isEmpty, numberOfDimensions, numberOfElements, set, set, setMaxValidIndex
public MWCellArray()
This example creates an empty MWCellArray object:
MWCellArray C = new MWCellArray(); System.out.println("C = " + C.toString());When run, the example displays this output:
C = []
public MWCellArray(int rows, int cols)
rows
- Number of rows. Number of rows must be non-negative.cols
- Number of columns. Number of columns must be non-negative.java.lang.NegativeArraySizeException
- A negative row or column size is supplied.public MWCellArray(int[] inDims)
inDims
- Array of dimension sizes. Each dimension size must be non-negative.java.lang.NegativeArraySizeException
- A negative dimension size is supplied.
This example constructs and initializes a 2-by-3 MWCellArray object:
int[] cdims = {2, 3}; MWCellArray C = new MWCellArray(cdims); Integer[] val = new Integer[6]; for (int i = 0; i < 6; i++) val[i] = new Integer(i * 15); for (int i = 0; i < 2; i++) for (int j = 0; j < 3; j++) { int[] idx = {i+1, j+1}; C.set(idx, val[j + (i * 3)]); } System.out.println("C = " + C.toString());When run, the example displays this output:
C = 2x3 cell array
public java.lang.String toString()
public boolean equals(java.lang.Object obj)
© 1994-2017 The MathWorks, Inc. Patents Trademarks