Azzera filtri
Azzera filtri

For ... Next Loops

3 visualizzazioni (ultimi 30 giorni)
Paul Mitchell
Paul Mitchell il 15 Dic 2020
Commentato: Paul Mitchell il 19 Dic 2020
The problem
I would like to use xlsread to define inputs to a function - I have many combinations of inputs to contend
with (5000) and feel it would be easier to control via the use of an Excel Spreadsheet (rather than hard
coding in matlab)
However some of the inputs my be defined as say a = single doubles, b = loop from min:step:max, and
and c = series [low mid high] or even textual array. These would have to then form nested loops to step
over all combinations. Is there a method i can use within matlab m file to control how to configure to loops
I could loop round all the inputs in the xls sheet (accessed via xlsread) doing a checks to determine
which format the input may take and hence forming a nested loop
for loop1=a
for loop2=b
for loop3=c
DoFunc = func(loop1, loop2, loop3)
end
end
end
but given I may have 50 variables I do not really want 50 nested loops
Any suggestions of a elegant method (or alternatives) I could employ
Thank You
  3 Commenti
Paul Mitchell
Paul Mitchell il 19 Dic 2020
Stephen, thank you for the links, I think the allcomb function referenced on the final link is something I can use, its just a matter of sorting out how to get Matlab to handle inputs on the Excel worksheet which could be defined as either
Single values i.e. A = 5000;
Or a defined set of values A = [5000 10000 15000];
Or a range of values such A = 5000:5000:15000;
The singles I would not want to occupy the allcomb fields, but either of the other two options I would
I'll keep playing with my script to see if I can comeup with an elegant solution
Regards, Paul

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Environment and Settings in Help Center e File Exchange

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by