Skip to Main Content Skip to Search
Product Documentation

javaArray - Construct Java array

Syntax

objArray = javaArray(PackageName.ClassName,x1,...,xn)

Description

objArray = javaArray(PackageName.ClassName,x1,...,xn) constructs an empty Java array for objects of the specified Java class.

Tips

Input Arguments

PackageName.ClassName

String specifying Java class. You must include the package name when specifying the class.

x1,...,xn

Dimensions of the array.

Output Arguments

objArray

Java array with dimensions x1,...,xn.

Examples

This example constructs and populates a 4-by-5 array of java.lang.Double objects.

dblArray = javaArray ('java.lang.Double', 4, 5);
for m = 1:4
   for n = 1:5
   dblArray(m,n) = java.lang.Double((m*10) + n);
   end
end

dblArray

dblArray =
java.lang.Double[][]:
    [11]    [12]    [13]    [14]    [15]
    [21]    [22]    [23]    [24]    [25]
    [31]    [32]    [33]    [34]    [35]
    [41]    [42]    [43]    [44]    [45]

See Also

class | isjava | javaMethodEDT | javaObjectEDT | methodsview

  


» Learn more
» Download free kit
» Get trial software

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS