MATLAB Answers

Problem with data saving in a for loop

1 view (last 30 days)
Hi all,
I have prepared a script to execute a code in 3 different folders, even though, I can verify that my script go through the 3 folders calculating my variables, in the end I have one problem it only writes into my excel sheet the last values calculated(in the last folder, overwriting the values calculated in the former 2 folders), how can I fix the code for obtaining my three columns with their variables?, the code is attached.
Thanks in advance

  0 Comments

Sign in to comment.

Accepted Answer

prasanth s
prasanth s on 10 Oct 2019
you have to put the 'xlswrite' functions inside the for loop. also, for each iteration, change the sheet number or the 'xlRange' (selected columns).

  1 Comment

Tony Castillo
Tony Castillo on 11 Oct 2019
Thank you so much this insight worked perfectly.

Sign in to comment.

More Answers (1)

prasanth s
prasanth s on 10 Oct 2019
Best solution is:
store the output variable 'vector' fom each iteration, into another variable(array, cell array). then at the end of program, write all data to the sheet.

  0 Comments

Sign in to comment.

Products


Release

R2019b

Translated by