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

62 visualizzazioni (ultimi 30 giorni)
For example, I simulated a model and generated a Plot1 in SIMBiology Model Analyzer. How can I export it using MATLAB code?

Risposta accettata

Priya Moorthy
Priya Moorthy il 24 Dic 2024 alle 15:11
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 Commenti
Priya Moorthy
Priya Moorthy il 25 Dic 2024 alle 2:59

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

Accedi per commentare.

Più risposte (1)

Sumukh
Sumukh il 24 Dic 2024 alle 10:27
Modificato: Sumukh il 24 Dic 2024 alle 10:28
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.

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by