How to save each iteration of a loop into the same sheet of an Excel spreadsheet?
Afficher commentaires plus anciens
Hello, I'm still relatively new to MATLAB.
I am trying to save data into an Excel Sheet, I have successfully managed to save single iteration of the loop in a given sheet. I have managed to save each iteration in a new sheet(as shown below in the code). However, I am interested in saving each iteration in the same sheet but within the following row of the Excel sheet. For example, heading save to row 1. Iteration 1 save to row 2, Iteration 2 save to row 3 and so on.
I understand I can specify the range ('Range','A1') for example to save to row 1. However, I do not know how to make the Range vary in relation to the length of START. What I mean is, if it is Iteration 2 how can I specify 'A3". The end purpose of the code is to generate large amounts of data.
filename = 'Test.xlsx';
z = 1;
START = [0.2:0.1:0.9];
for i = 1:length(START);
start = START(i);
global start;
run 'Improved.' %m.file named 'Improved.m'
Table_1 = table(z,n,A,B,C,D); %variables "z,n,A,B,C,D" are generated within Improved.m
z = z+1;
sheet = z;
writetable(Table_1,filename,'Sheet',z,'Range','A1')
end
Thank you
Réponse acceptée
Plus de réponses (1)
Eng. Fredius Magige
le 13 Oct 2015
0 votes
Hi Iam not competent with the rest, except (note that, if table(table(z,n,A,B,C,D)) is common in coding or your own code), you have:
start(i,1)=START(i); %etc
which might assist in row and column arrangment
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!