I have a 1 x 118 matrix called current_load
that I need to update periodically. This matrix resides in the main workspace of Matlab (as shown in the code bellow).
current_loads = zeros(1, 118);
for col=1:118
current_loads(1,col)=10; %// Initially give all nodes a current load of 10
end
recursive_remove(current_loads); %calling function
This matrix will be passed to a function call recursive_remove
(shown bellow).
function updater = recursive_remove( current_load )
current_load(1,3) = 2.6; %// This update can't be seen from main ??
%this function will be called recursively later
end
But whatever updates I do to this current_load
matrix from the function, it will not get updated since I don't know how to pass it by reference.
I am new to Matlab. I would greatly appreciate if you can show with an example how to handle this
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…