How to iterate through every combination of user's choice of parameters?
4 次查看(过去 30 天)
显示 更早的评论
I am scripting a parameter study in which the user identifies model parameters to vary as well as that parameter's values, for example:
parameterList(1).name = 'patientWeight' ;
parameterList(1).value = 100:25:300 ;
parameterList(2).name = 'dosage' ;
parameterList(2).value = 1000:1000:50000 ;
I want to perform a model run for all combinations of parameter values. Iterating is easy if the chosen parameters are the same for each study:
for iWeight = 1:length(parameterList(1).value)
for iDosage = 1:length(parameterList(2).value)
% Perform simulation and save results
end
end
But here the parameters and their values differ each time the script is run (next time, user might specify 'patientAge', 'numberOfDoses', and 'yearsOfTreatment'). How do I generate all combinations of parameters values from a changing list? (Would eventually like to use the parallel processing toolbox, if that is relevant.)
0 个评论
回答(1 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!