newInstance
public static MATLABArray.MATLAB_Array newInstance(Object data,
MWAttributesContainer mwAttributesContainer)
Creates an instance of MATLABArray.MATLAB_Array protobuf message based on the input data
data must be a Convertible Data Type.
The following are all Convertible Data Types, enumerated
along with the type of MATLAB Array to which they are converted to.
java.lang.Byte data -> MATLAB type: int8 dimensions: { 1, 1 }
byte[] data -> MATLAB type: int8 dimensions: { 1, data.length }
java.lang.Short data -> MATLAB type int16 dimensions: { 1, 1 }
short[] data -> MATLAB type int16 dimensions: { 1, data.length }
java.lang.Integer data -> MATLAB type int32 dimensions: { 1, 1 }
int[] data -> MATLAB type int32 dimensions: { 1, data.length }
java.lang.Long data -> MATLAB type int64 dimensions: { 1, 1 }
long[] data -> MATLAB type int64 dimensions: { 1, data.length }
java.lang.Float data -> MATLAB type single dimensions: { 1, 1 }
float[] data -> MATLAB type single dimensions: { 1, data.length }
java.lang.Double data -> MATLAB type double dimensions: { 1, 1 }
double[] data -> MATLAB type double dimensions: { 1, data.length }
java.lang.Boolean data -> MATLAB type logical dimensions: { 1, 1 }
boolean[] data -> MATLAB type logical dimensions: { 1, data.length }
java.lang.Character data -> MATLAB type char dimensions: { 1, 1 }
char[] data -> MATLAB type char dimensions: { 1, data.length }
java.lang.String data -> MATLAB type char dimensions: { 1, data.length() }
java.lang.String[] data -> MATLAB type cell dimensions: { 1, data.length }
java.lang.Object[] data -> MATLAB type cell dimensions: { 1, data.length }
In addition, for any Convertible Data Type T, the following
Java type is also a Convertible Data Type*:
T[] data -> (MATLAB type for T) dimensions: { data.length, dimensions(T[0]) } if T is an Array
dimensions: { 1, data.length } if T is not an Array
*The caveat is that if T is an array type, then all elements of data
must have exactly the same length.
The output MATLAB Array has the same dimensions as the input data. A 1-D input
data of size n will create MATLAB Array of dimension 1xn.
An Empty Array in the context of this method is defined as an array with 0 elements or
an array with atleast one of its elements as an Empty Array. If data is Empty Array,
MATLAB Array created using it will have same dimensions as input
(except for the 1-D rule mentioned above) and will have 0 number of elements.
- Parameters:
data - Data to be used to create a MATLABArray.MATLAB_Array protobuf message
- Returns:
- An instance of MATLABArray.MATLAB_Array