MATLAB: How to change the variable name in the loop

eval functionname change

I want to use this syntax in a loop, but i can't find out why it does not work. I know, I should use the eval function, but somewhere there has to be a problem in the syntax. Could you help me to fix it?
thanks, Roley
I want to change te i variable in the code:
for to i=1:2 eval(['xlswrite('D:\Pénzügyek\Market\Trading System\Neural networks\FORECASTING MODELL\Modells\' num2srt(i) '.xlsx', modell ' num2srt(i)', 'data','A1')])
end

Best Answer

You should edit your code using {}code while posting the question, I can see one problem, there should not be to after for , Also its better to use i1 in place of i because i represents imaginary number in MATLAB.