Main Content

Conversion of Java Types to MATLAB Types

Pass Data from Java to MATLAB Production Server

When you pass data as input arguments to deployed MATLAB® functions from Java®, MATLAB Production Server™ converts the data into equivalent MATLAB data types.

Value Passed to Java MethodInput type Received by MATLABDimension of Data in MATLAB

java.lang.Byte, byte

int8{1,1}

byte[] data

{1, data.length}

java.lang.Shortshort

int16{1,1}

short[] data

{1, data.length}

java.lang.Integer, int

int32{1,1}

int[] data

{1, data.length}

java.lang.Long, long

int64{1,1}

long[] data

{1, data.length}

java.lang.Float,float

single{1,1}

float[] data

{1, data.length}

java.lang.Double, double

double{1,1}

double[] data

{1, data.length}

java.lang.Boolean, boolean

logical{1,1}

boolean[] data

{1, data.length}

java.lang.Character, char

char{1,1}

char[] data

{1, data.length}

java.lang.String data

{1, data.length()}

java.lang.String[] data

cell{1, data.length}

java.lang.Object[] data

{1, data.length}

T[] data

MATLAB type for T { data.length, dimensions(T[0]) }, if T is an array
{ 1, data.length}, if T is not an array

Pass Data from MATLAB Production Server to Java

When deployed MATLAB functions return output arguments, MATLAB Production Server converts the data into equivalent Java data types.

MATLAB Output Argument Data TypeDimension of Data in MATLABResulting Java Data Type
int8, uint8{1,1}byte,java.lang.Byte
{1,n} , {n,1}byte[n], java.lang.Byte[n]
{m,n,p,...}byte[m][n][p]... , java.lang.Byte[m][n][p]...
int16, uint16{1,1} short, java.lang.Short
{1,n} , {n,1}short[n], java.lang.Short[n]
{m,n,p,...}short[m][n][p]... , java.lang.Short[m][n][p]...
int32, uint32{1,1}int, java.lang.Integer
{1,n} , {n,1}int[n], java.lang.Integer[n]
{m,n,p,...}int[m][n][p]... , java.lang.Integer[m][n][p]...
int64, uint64{1,1}long, java.lang.Long
{1,n} , {n,1}long[n], java.lang.Long[n]
{m,n,p,...}long[m][n][p]... , java.lang.Long[m][n][p]...
single{1,1}float, java.lang.Float
{1,n} , {n,1}float[n], java.lang.Float[n]
{m,n,p,...}float[m][n][p]... , java.lang.Float[m][n][p]...
double{1,1}double, java.lang.Double
{1,n} , {n,1}double[n], java.lang.Double[n]
{m,n,p,...}double[m][n][p]... , java.lang.Double[m][n][p]...
logical{1,1}boolean, java.lang.Boolean
{1,n} , {n,1}boolean[n], java.lang.Boolean[n]
{m,n,p,...}boolean[m][n][p]... , java.lang.Boolean[m][n][p]...
char{1,1}char, java.lang.Character
{1,n} , {n,1}java.lang.String
{m,n,p,...}char[m][n][p]... , java.lang.Character[m][n][p]...
cell (containing only strings){1,1}java.lang.String
{1,n} , {n,1}java.lang.String[n]
{m,n,p,...}java.lang.String[m][n][p]...
cell (containing multiple types){1,1}java.lang.Object
{1,n} , {n,1}java.lang.Object[n]
{m,n,p,...}java.lang.Object[m][n][p]...