I operate on global variable the way below in code. I want to save every time to global variable and keep its content so that it expands. If I declare function with output being this variable, in case of huge structures it may significantly slow down I assume. How to do it?
function test()
global n1;
n1 = [1 2 3];
for x=1:10
% [n1] = global_up(n1,x); % no need for output parameter, as n1 is global right?
f_up(n1,x);
end
end
function f_up(arg1,arg2) %function [arg1] = f_up(arg1,arg2) is wrong?
global n1; % need to write it in every function ?
arg1 = [arg1 arg2];
end