MATLAB: Copy a handle of an Array

array handle reference copyMATLAB

I want a method to copy a handle of an Array not the Array Elements. like the java Arrays. for Example: X = [3 3 3]; A = handle(X); so when I change A, X will Automatically changed. so: A(2) = 0; will case that x = 3 0 3

Best Answer

You cannot do it. While MATLAB supports handle classes, you cannot subclass double to be a handle class. There are a number of different ways to work around the problem, can you provide more about what you want to do?
If you are simply trying to avoid memory issues, MATLAB handles that behind the scenes and often there isn't a memory advantage between passing arrays, handles or pointers.