Package matlabcontrol.link
Class MatlabInt32Array<T>
- java.lang.Object
-
- matlabcontrol.link.MatlabInt32Array<T>
-
- Type Parameters:
M-intarray type, ex.int[],int[][],int[][][], ...
public class MatlabInt32Array<T> extends java.lang.Object- Since:
- 4.2.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)MatlabInt32getElementAtIndices(int row, int column, int... pages)Gets the element at the specifiedrow,column, andpages.MatlabInt32getElementAtLinearIndex(int index)Gets the element atindextreating this array as a MATLAB column vector.static <T> MatlabInt32Array<T>getInstance(T real, T imaginary)intgetLengthOfDimension(int dimension)Returns the length of the dimension specified bydimension.intgetNumberOfDimensions()Returns the number of dimensions of the array.intgetNumberOfElements()The number of elements in the array.inthashCode()booleanisReal()Returnstrueif the array has no imaginary values,falseotherwise.TtoImaginaryArray()Returns an array that holds the imaginary values from the MATLAB array.TtoRealArray()Returns an array that holds the real values from the MATLAB array.java.lang.StringtoString()Returns a brief description of this array.
-
-
-
Method Detail
-
getInstance
public static <T> MatlabInt32Array<T> getInstance(T real, T imaginary)
-
getElementAtLinearIndex
public MatlabInt32 getElementAtLinearIndex(int index)
Gets the element atindextreating this array as a MATLAB column vector. This is equivalent to indexing into a MATLAB array with just one subscript.- Returns:
- element at
index - Throws:
java.lang.ArrayIndexOutOfBoundsException- ifindexis out of bounds
-
getElementAtIndices
public MatlabInt32 getElementAtIndices(int row, int column, int... pages)
Gets the element at the specifiedrow,column, andpages.- Returns:
- element at
row,column, andpages - Throws:
java.lang.IllegalArgumentException- if number of indices does not equal this array's number of dimensionsjava.lang.ArrayIndexOutOfBoundsException- if the indices are out of bound
-
isReal
public boolean isReal()
Returnstrueif the array has no imaginary values,falseotherwise. Equivalent to the MATLABisrealfunction.- Returns:
-
toRealArray
public T toRealArray()
Returns an array that holds the real values from the MATLAB array. Each call returns a new copy which may be used in any manner; modifications to it will have no effect on this instance.- Returns:
- real array
-
toImaginaryArray
public T toImaginaryArray()
Returns an array that holds the imaginary values from the MATLAB array. Each call returns a new copy which may be used in any manner; modifications to it will have no effect on this instance. If this array is real then the returned array will be have0as all of its base elements.- Returns:
- imaginary array
-
getNumberOfElements
public int getNumberOfElements()
The number of elements in the array. The real and imaginary components of a number are together considered one element. This is equivalent to MATLAB'snumelfunction.- Returns:
- number of elements
-
getLengthOfDimension
public int getLengthOfDimension(int dimension)
Returns the length of the dimension specified bydimension. Dimensions use 0-based indexing. So the first dimension, which is dimension 0, is the row length. The second dimension is the column length. The third dimension and beyond are pages.- Parameters:
dimension-- Returns:
- length of
dimension - Throws:
java.lang.IllegalArgumentException- ifdimensionis not a dimension of the array
-
getNumberOfDimensions
public int getNumberOfDimensions()
Returns the number of dimensions of the array.- Returns:
- number of dimensions
-
toString
public java.lang.String toString()
Returns a brief description of this array. The exact details of this representation are unspecified and are subject to change.- Overrides:
toStringin classjava.lang.Object- Returns:
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-