How to export or save a plot simualted in SimBiology Model Analyzer using MATLAB command?
显示 更早的评论
For example, I simulated a model and generated a Plot1 in SIMBiology Model Analyzer. How can I export it using MATLAB code?
采纳的回答
更多回答(1 个)
The plot handles within the SimBiologyModelAnalyzer app cannot be accessed directly from the MATLAB command window to save them using code.
A possible workaround is to run the model analysis using MATLAB program files from the MATLAB command window instead of the app. The plots generated can then be accessed using their handles to export them.
Kindly refer to the following steps to export the plots generated using SimBiologyModelAnalyzer for an example project:
1. Open the example project Bioavailability.sbproj by entering the following command in the command window:
simBiologyModelAnalyzer("Bioavailability.sbproj")
2. Please follow the steps specified in the following documentation to plot the simulation results of the above example: https://www.mathworks.com/help/releases/R2023a/simbio/ug/view-run-program-code-simbiology-model-analyzer.html
3. As specified in the above documentation, the sbioplot command plots the simulation result from the MATLAB command window. It returns the axes handle of the figure that can be accessed as follows:
ax1 = sbioplot(programResults.output.results);
4. The figure generated can now be saved as an image by typing the following command in the command window:
exportgraphics(ax1,"Plot1.jpg")
You can refer to the following documentation on exportgraphics command to know more about exporting figures:
The above code can be modified to save multiple plots generated from the project at a time.
I hope this answers your query.
类别
在 帮助中心 和 File Exchange 中查找有关 Import Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
