Dear list,

My caller function sends several input arguments (i.e. vectors and 
matrices) to a function, but not all changes are visible once the function 
completes. It took a while to figure out the problem, but I managed to 
create a simple example (see below). Is there a way to avoid global 
variables here? Thank you!

function test1(input) # changes visible in caller
 for n in 1:length(input)
   input[n] = input[n]+2
 end 
end
 
function test2(input) # changes invisible in caller
 input = rand(length(input))
end


Reply via email to