I have edited this post several times, but I think this is the clearest way to state my problem.
I am attempting to use a nested sweep underneath an optimization. I would like to define my own custom figure of merit that requires data from all (two) elements of the nested sweep. Each individual element of the sweep outputs an array of 5000 elements.
As a result, I should have access to two arrays of 5000 elements in my figure of merit script, or a 5000x2 dimensional array, however I only have access to one 5000x1 dimensional array.
How can I get the data from both elements of the sweep to calculate my figure of merit? I have seen an example here: Optimization of geometrical parameters for two possible states with different material properties however this appears to calculate a single number ® and then return an array containing both Rs such that R(1) and R(2) access the two values.
I do not see anything fundamentally different in my code from this example, other than the fact that the elements of the sweep return an array and not a single number. What could be going wrong? Thank you.