External Interfaces/API    

Concatenating Java Objects

You can concatenate Java objects in the same way that you concatenate native MATLAB data types. You use either the cat function or the square bracket operators to tell MATLAB to assemble the enclosed objects into a single object. If all of the objects being operated on are of the same Java class, then the concatenation of those objects will be an array of objects from the same class.

In the following example, the cat function concatenates two objects of the class java.awt.Point. The class of the result is also java.awt.Point.

In this second example, the MATLAB square bracket operators are used to concatenate two objects of unlike classes. The resultant class is java.lang.Object, which is the root of the Java class hierarchy.


 Creating and Using Java Objects Saving and Loading Java Objects to MAT-Files