Problem with data saving in a for loop

1 回表示 (過去 30 日間)
Tony Castillo
Tony Castillo 2019 年 10 月 10 日
コメント済み: Tony Castillo 2019 年 10 月 11 日
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

採用された回答

prasanth s
prasanth s 2019 年 10 月 10 日
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 件のコメント
Tony Castillo
Tony Castillo 2019 年 10 月 11 日
Thank you so much this insight worked perfectly.

サインインしてコメントする。

その他の回答 (1 件)

prasanth s
prasanth s 2019 年 10 月 10 日
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.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by