how to save variables

조회 수: 2 (최근 30일)
Ilaria Shireen Sestili
Ilaria Shireen Sestili 2020년 7월 22일
댓글: Ilaria Shireen Sestili 2020년 7월 22일
Hello,
after I have run my simulation I obtaind these variables in my workspace and I would like to save them on excel.
Does someone knows a code that I can use? since they are many variables in an array type, but I haven't found yet a code that does wokr for me.
I would like to save product, TIS, error and error2
thanks in advanced
  댓글 수: 1
KSSV
KSSV 2020년 7월 22일
You can save them into .mat file. REad about save.

댓글을 달려면 로그인하십시오.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2020년 7월 22일
xlswrite('MyFile.xlsx',[product, TIS, error, error2])
  댓글 수: 9
Ilaria Shireen Sestili
Ilaria Shireen Sestili 2020년 7월 22일
thank you so much!!!
Ilaria Shireen Sestili
Ilaria Shireen Sestili 2020년 7월 22일
it works perfectly

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

rough93
rough93 2020년 7월 22일
편집: rough93 2020년 7월 22일
First, let's convert your data to tables:
product_table = array2table(product);
TIS_table = array2table(TIS);
error_table = array2table(error);
error2_table = array2table(error2);
then, you can specify the filename you want:
filename = 'your_filename.xlsx';
and write each table to your file on a different sheet:
writetable(product_table,filename,'Sheet',1)
writetable(TIS_table,filename,'Sheet',2)
writetable(error_table,filename,'Sheet',3)
writetable(error2_table,filename,'Sheet',4)
  댓글 수: 3
rough93
rough93 2020년 7월 22일
Follow Fangjun's suggestion and let us know the answer, this code should be included in the editor after all the outputs are created/saved.
Ilaria Shireen Sestili
Ilaria Shireen Sestili 2020년 7월 22일
thanks!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Discrete-Event Simulation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by