The structfun function only works on scalar struct arrays, iterating over the fields of that scalar struct. While you could use arrayfun, it may be easier to understand (and perform just as well) if you use a for loop. I know people have said "Don't use for loops in MATLAB, they're slow." While that may have been true in the past (and you can still write a for loop so it is slow in current MATLAB) the performance of for loops have increased significantly with the improvements we have made to MATLAB over the years.
Besides a for loop over 8 elements of a struct array calling size is highly unlikely, in my experience, to be the bottleneck in your code.
Best Answer