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일

0 개 추천

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
MHN
MHN 2016년 4월 28일
No problem. Sure, you can do it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2016년 4월 27일

댓글:

MHN
2016년 4월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by