Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

javaArray - Construct Sun Java array

Syntax

javaArray('package_name.class_name',x1,...,xn)

Description

javaArray('package_name.class_name',x1,...,xn) constructs an empty Java array capable of storing objects of Java class, 'class_name'. The dimensions of the array are x1 by ... by xn. You must include the package name when specifying the class.

The array that you create with javaArray is equivalent to the array that you would create with the Java code

A = new class_name[x1]...[xn];

Examples

The following 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

javaObject, javaMethod, class, methodsview, isjava

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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