Borrar filtros
Borrar filtros

For ... Next Loops

3 visualizaciones (últimos 30 días)
Paul Mitchell
Paul Mitchell el 15 de Dic. de 2020
Comentada: Paul Mitchell el 19 de Dic. de 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 comentarios
Paul Mitchell
Paul Mitchell el 19 de Dic. de 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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by