I did not run your code, just read through but I believe you run into the fact that MATLAB makes cdata opy when you change an element only when same whole data are shared by 2 or more variables.
A = rand(10000);
B = A;
B(1) = 1;
B(1) = 2;
That explains the behaviour you see and handle class and the data is unique.
For other container, because of the function you put around, and variable are used in LHS on both RHS, MATLAB CANNOT assume whereas the LSH is the same as RHS, so it copies systematically the arrays.
Also your timining is flawed by the fact that you call function and use global statement. The overhead of those will introduce bias in yout time. Personally I never time something small but putting them in a function.
Never put small instructions in a function with MATLAB, it will kill the performance.