I want to use large arrays with 1.0e6 elements in other Matlab functions. Currently I am using small sized arrays and passing them as function input. I do not how much this passing of arrays going to affect the speed of my program when I use large arrays. It is also possible that I save these input large sized arrays as .mat file and then load them in other Matlab functions for use.
So, my question is: which way is faster? Saving the arrays in .mat file and then loading them in Matlab functions or passing them as function input.
Passing them as inputs to your function is the fastest as Matlab passes variables by reference (until you change them - then it would make a copy)
Saving and loading from file will definitely be slower!