Best way to pass large amounts of variables between functions
Show older comments
Hi everyone! This is more of a general question rather than a straight single answer. What would be the best way to pass variables between functions? Such as: using a structure to store multiple variables, use a temporary .mat file containing the variables and load in when needed, use global variables, or pass many variables into each respective function call. I am redoing my codebase in order to try and save memory and increase its speed.
I ask because I have many initilization variables (30 - 40 unique variables) and output variables (20 unique variables each being NxNxM matricies N is 512 or 1024) and it is a nightmare for me to organize the information. I have many smaller functions compartmentalized but each function is dependent on the initilization variables.
If anyone has general hints or methods they would like to share for passing large amounts of information between functions let me know! Any insights would be greatly appriciated!
Accepted Answer
More Answers (0)
Categories
Find more on Variables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!