Values from For Loop Iteration to save on an extra m.File
Ältere Kommentare anzeigen
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!
Akzeptierte Antwort
Weitere Antworten (2)
Trier87
am 13 Dez. 2012
3 Kommentare
Thanks for posting your solution.
In your code you have not pre-initialized the variable - data and its size is growing in the loop. This makes the code to run slow as size of data will increase in the loop.
And regarding your new question, how your output will look in this case ?
Trier87
am 13 Dez. 2012
TAB
am 13 Dez. 2012
Buff = zeros(numel(850:10:870)*numel(1286:10:1306),3);
Ctr = 1;
for EG = 1286:10:1306
for PC=850:10:870
Main
Buff(Ctr, 1) = PC;
Buff(Ctr, 2) = EG;
Buff(Ctr, 3) = XXX;
Ctr = Ctr+1;
end
end
save test.dat Buff;
Kategorien
Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!