How to export or save a plot simualted in SimBiology Model Analyzer using MATLAB command?

4 ビュー (過去 30 日間)
For example, I simulated a model and generated a Plot1 in SIMBiology Model Analyzer. How can I export it using MATLAB code?

採用された回答

Priya Moorthy
Priya Moorthy 2024 年 12 月 24 日
Plots in the SimBiology Model Analyzer can be exported, saved or printed. You can right-click anywhere on the plot and choose "Export Plot", "Save" or "Print" from the context menu. If you export the plot, you will get a standalone figure that you then can modify through the MATLAB Desktop graphics tools or programmatically via the command prompt (click on the figure and use the gcf command to get the handle to the exported figure).
Best,
Priya
  6 件のコメント
Priya Moorthy
Priya Moorthy 2024 年 12 月 25 日

Shawn,

The version number you have corresponds to the original general release of R2023a. Unfortunately, there is no workaround; the fix requires Update 3 of R2023a. Are you able to rev to the update release or to a later release such as R2024b?

If not, and if you are able to share your project with us, you can contact technical support to export the plot.

Best, Priya

Shawn
Shawn 2024 年 12 月 25 日
Thank you for your help!

サインインしてコメントする。

その他の回答 (1 件)

Sumukh
Sumukh 2024 年 12 月 24 日
編集済み: Sumukh 2024 年 12 月 24 日
Hi @Shawn,
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.

カテゴリ

Help Center および File ExchangeImport Data についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by