フィルターのクリア

For ... Next Loops

3 ビュー (過去 30 日間)
Paul Mitchell
Paul Mitchell 2020 年 12 月 15 日
コメント済み: Paul Mitchell 2020 年 12 月 19 日
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 件のコメント
Paul Mitchell
Paul Mitchell 2020 年 12 月 19 日
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

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by