How could I make these functions as a loop?

2 次查看(过去 30 天)
Hi all, How could I make these functions as a loop? these is the functions output1=net1(Test_Inputs); output2=net2(Test_Inputs); output3=net3(Test_Inputs); output4=net4(Test_Inputs); output5=net5(Test_Inputs);

采纳的回答

MHN
MHN 2016-4-27
It is not a good idea to use this kind of coding, but the following code will do what you want.
for i = 1:5
a = sprintf('output%d=net%d(Test_Inputs);', i,i);
eval(a)
end
  2 个评论
mahmoud mosa
mahmoud mosa 2016-4-28
编辑:mahmoud mosa 2016-4-28
thanks a lot, it is perfectly work. but, could i put 'i =1: n' and make it as a function of (n) according to the number of nets i have

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by