Help creating variable list listing all combinations for DOE
Mostrar comentarios más antiguos
Problem: An application (not MATLAB) reads in a text file which is a list of variables it will calculate. Each variable requires somewhere between 1 and 5 inputs. I need to create an exhaustive list of every combination of input variables for a design of experiments. The end result is a list with millions of lines showing each variable with every possible combination of inputs written to a text file.
Example: See the attached image showing the list of variables. CAPS specify the variable name and italics specify required inputs (separated by spaces).
For the sake of brevity, lets look at only the first 3 variables:
CUBIC PER ATR _HistLength_ ATRlength_
RSI _HistLength_
STOCHASTIC K _HistLength_
The inputs are HistLength and ATRlength which can take on the following values:
_HistLength_ = [10 50 100]
_ATRlength_ = [5 15 25]
The resulting text file would be (order of list is not important):
CUBIC PER ATR 10 5
CUBIC PER ATR 50 5
CUBIC PER ATR 100 5
CUBIC PER ATR 10 15
CUBIC PER ATR 50 15
CUBIC PER ATR 100 15
CUBIC PER ATR 10 25
CUBIC PER ATR 50 25
CUBIC PER ATR 100 25
RSI 10
RSI 50
RSI 100
STOCHASTIC K 10
STOCHASTIC K 50
STOCHASTIC K 100
Now try that for 100 variables with 1 to 5 inputs each and the list gets prohibitively long to type by hand!
What I've Tried: My previous attempts use strfind() in a loop to determine whether an input is present (such as HistLength) and, if true, use strrep() to replace the input string (HistLength) with the numerical values. Once multiple inputs are involved things get messy.
I am happy to provide examples of what I've tried but so none of them worked as they should. Mainly looking for suggestions as to how to approach the problem in an efficient manner.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!