It is passed by reference until you change Itemp .
When changing Itemp matlab will copy binaryImage to Itemp and then change it.
I did some interesting tests, and then I went. If you do:
A=rand(100);B=A;C=B;D=A;E=B;
only one copy is stored in memory. If you change A
A(1)=1;
Then matlab will make one a new copy of the matrix for new A , and the variables B , C , D , E still point to the matrix of old A
Oli
source share