Hi all I want to call function/script iteratively as I made mutants of a program and each mutant ends with a iteration number. The problem is that I need to change function name iteratively with each iteration of matlab code. Please help me out. My sample mutants are ArithOper1(input),ArithOper2(input),ArithOper3(input),........
Thanks you in Advance
No products are associated with this question.
So you have a bunch of functions called ArithOper1.m, ArithOper2.m, ArithOper3.m, etc? If there's a small enough number of these, you can call the appropriate one using a simple switch construct
switch n case 1 % call ArithOper1 case 2 % call ArithOper2 end
If this is unwieldy, you can use eval:
fnm = ['ArithOper',num2str(n)]; str = ['z = ',fnm,'(x,y);']; % z = ArithOperN(x,y) eval(str);