for文で連番の関数を順に実行したい(初心者です。
7 views (last 30 days)
Show older comments
プログラム初心者です。よろしくお願いいたします。
fun01(),fun02(),...fun10() と連番の関数が10個あります。
これらに同じ入力Inputを入れ、fun01()から順に実行したいです。
ただし、関数名はしょっちゅう変わるので、一括で指定したいしたいです。
forで文で回そうとしましたが、ans = 'fun01(INPUT)'という風に文字型で保存されてしまいました。
%%%%一括で関数名の定義%%%
fun_hed = 'fun'
in ='(INPUT)'
%%%%%%%%%%%%%%%%
for i = 1:10
ans = [fun_hed,num2str(i),IN] % ⇒ 'fun〇〇(INPUT)'の出力を得たい
...
end
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on ループと条件付きステートメント in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!