how to save variables
2 次查看(过去 30 天)
显示 更早的评论
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![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/335481/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/335481/image.png)
thanks in advanced
采纳的回答
更多回答(1 个)
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
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete-Event Simulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!