MATLAB: Structure array slower than loose variables

efficiencyfunctionspeedstructurestructure arraysvariables

I need to pass a large number of variables into a number of functions. Passing every variable individually is messy and makes expansion of the code tricky. I used structured arrays to tidy up my variables and package them together into related groups but I have found that this significantly slows down my code (takes approximately 40% longer to execute). I have tried 'unpacking' my data using Method 1 in the following question but this makes no difference.
Loose variables:
output=examplefunction(variable1,variable2,variable3)
Structured:
output=examplefunction(SimulationParameters)
% Unpack data
variable1=SimulationParameters.variable1;
variable2=SimulationParameters.variable2;
variable3=SimulationParameters.variable3;
Are strutures always slower? Are there any other methods for speeding up structures? Official Matlab documentation doesn't provide any guidance on speed. This web page seems to suggest that structures are tidy but slow.
Thanks, M

Best Answer

Yes acessing field names is slow., so try to avoid doing it intensively.