how to save variables

1 Ansicht (letzte 30 Tage)
Ilaria Shireen Sestili
Ilaria Shireen Sestili am 22 Jul. 2020
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 Kommentar
KSSV
KSSV am 22 Jul. 2020
You can save them into .mat file. REad about save.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 22 Jul. 2020
xlswrite('MyFile.xlsx',[product, TIS, error, error2])
  9 Kommentare
Ilaria Shireen Sestili
Ilaria Shireen Sestili am 22 Jul. 2020
thank you so much!!!
Ilaria Shireen Sestili
Ilaria Shireen Sestili am 22 Jul. 2020
it works perfectly

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

rough93
rough93 am 22 Jul. 2020
Bearbeitet: rough93 am 22 Jul. 2020
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 Kommentare
rough93
rough93 am 22 Jul. 2020
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 am 22 Jul. 2020
thanks!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Discrete-Event Simulation finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by