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 CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by