Running a Full Factorial DoE using user generated inputs

16 views (last 30 days)
I have written a program in which the user loads a given definition file and then runs that definition file through a series of functions to produce a desired result.
Added to this, I have made a GUI that allows the user to select certain parameters of that definition file and define a minimum value, a maximum value, and a number of steps between the two. Once the user finishes defining those selected parameters, the GUI runs the original program through each parameter range individually.
What I am trying to do is enable this GUI to run all the defined parameters simultaneously, essentially following a full factorial approach. I am having a hard time figuring out how to essentially make a self generating for loop that adds an index for each selected parameter. Anyone have any suggestions?

Answers (1)

Image Analyst
Image Analyst on 10 Nov 2015
You mean like a nested for loop:
for p1 = p1Start : p1Step : p1End
for p2 = p2Start : p2Step : p2End
for p3 = p3Start : p3Step : p3End
out = RunExperiment(p1,p2,p3); % Do your code (call your function(s))....
end
end
end
This will do every specified combination of the 3 parameters.
  2 Comments
Andrew Dodd
Andrew Dodd on 10 Nov 2015
That's what I'm trying to do, but want to be able to run between 1-45 different parameters. And it could be any value in between the two.
Image Analyst
Image Analyst on 10 Nov 2015
If you have 45 different parameters, and say each one takes on 10 values, then you'd have 10^45 different permutations. That would take a billion billion billion billion billion runs of your functions. So assuming your code runs in about a second, you could get through all of your experiments in about 7*10^38 years or about a 100 billion billion billion times the age of the universe. Are you prepared to wait that long?
For more reasonable numbers, like varying 2 or 3 parameters, you could also use meshgrid() instead of for loops. I don't know of any other way to handle varying the number of parameters you want to vary except to use all 45 in a gigantic nest and just have the ones you don't want to vary have the same starting and stopping values.

Sign in to comment.

Categories

Find more on App Building in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!