pass by value/reference in matlab/octave

394 views
Skip to first unread message

jake

unread,
Oct 27, 2011, 10:19:42 AM10/27/11
to NYC Machine Learning Review
some technical questions on how matlab/octave handle function
arguments came up in the review last night. here's a comprehensive
answer from doug hull (who's at mathworks):

http://www.mathworks.com/matlabcentral/answers/152-can-matlab-pass-by-reference

"MATLAB uses a system commonly called 'copy-on-write' to avoid making
a copy of the input argument inside the function workspace until or
unless you modify the input argument. If you do not modify the input
argument, MATLAB will avoid making a copy."

this is for "value objects"---read more for passing handle objects by
reference.

-j

p.s. i'm guessing octave has similar functionality, but am not certain
of this.
Reply all
Reply to author
Forward
0 new messages