MATLAB: Values from For Loop Iteration to save on an extra m.File

foor-loopiterationvalues

Hello, i have a .m-File with an For Loop Iteration. This .m-File calls another .m-File ( Main.m ) to solve some Variables ( for Example 'XXX' ) from the Iteration-Value PC
for PC=850:10:870
EG=1286
Main
save test.dat XXX
end
So the Program should take every new Iteration-Step into the Main.m and solve Things in it ( for Example Variable 'XXX' ) and then save it to a new .m-File ( for Example test.dat ). The Output should looks like this:
Column1(Iteration-Steps) Column2(Value of the Variable XXX form Main.m )
850 64874
860 65879
870 69766
I hope you Guys understand my Problem, big thx!

Best Answer

Buff = zeros(numel(850:10:870),2);
Ctr = 1;
for PC=850:10:870
EG=1286
Main
Buff(Ctr, 1) = PC;
Buff(Ctr, 2) = XXX;
Ctr = Ctr+1;
end
save test.dat Buff;
Related Question