My main script invites a subfunction, which then invites different subfunctions. I want these subfunctions to modify global variables. A simpified example:
function [varargout] = myfunc(a,b);
prod = arr(1)*arr(2);
p = prod;
When the main script calls p again it is empty. Why is this so and how can I fix it?