MATLAB: What is the most efficient way to pass many variables between many function calls

computation timefunction callsmemorystructuresvariables

I am currently working on a high-volume simulation environment for an end-to-end communications system. My problem is that each stage in the system is compartmentalized into a function call to reduce clutter in my top file, but I need to pass roughly 120 variables through each function. I run the program in batches of ~ 10-12 hours and would greatly appreciate input on the most effective way to transport these variables. I currently have them nested into 6 different structures that I pass directly through the function call, but I have no intuition as to whether or not this is an effective solution. Thanks!

Best Answer

Providing 6 structs sounds like an efficient method. I do not assume that the deliviering of some inputs is a bottleneck in your code. If this part of the code takes only 1% of the computing time, the highest possible acceleration is below 1% only.
So better use the profiler to find the bottleneck and focus any trials to optimize the code on this part only.