A few nonlinear systems of equations are being processed by a few functions. Each function can change some or all of the variables. fsolve is used in each function. There are many variables. Is there an easy way to share (or pass) related variables in the main workspace among these functions? Name of variables are already stored as strings in a variable_register in the main workspace. Is there a command like the following that can be executed inside functions to automate the global definition:
for k=1:length(variable_register)
eval(['global variable_register{',num2str(k),'}'])
end
2 件のコメント
Stephen Cobeldick (view profile)
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/459729-automating-global-definition-inside-multiple-functions#comment_700714
S H (view profile)
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/459729-automating-global-definition-inside-multiple-functions#comment_700727
サインイン to comment.