External Interfaces Previous page   Next Page

Creating a New Array Reference

Because Java arrays in MATLAB are references, assigning an array variable to another variable results in a second reference to the array.

Consider the following example where two separate array variables reference a common array. The original array, origArray, is created and initialized. The statement newArrayRef = origArray creates a copy of this array variable. Changes made to the array referred to by newArrayRef also show up in the original array.


Previous page  Concatenating Java Arrays Creating a Copy of a Java Array Next page

© 1994-2005 The MathWorks, Inc.