How to export simulink graoh to MATLAB plot?

2 ビュー (過去 30 日間)
ANANTA BIJOY BHADRA
ANANTA BIJOY BHADRA 2022 年 3 月 30 日
回答済み: Umang Pandey 2023 年 9 月 29 日
I have to create 2000 graphs using loops. Whenever I start running my code, it always shows the 1st iteration graph and saves it. The simulation is perfromed in simulink and I can see that the simulation is going accordingly but the main problem is on the figure saving. As I have said, it only saves the 1st figure. How can I sole this prolem?
  1 件のコメント
robinson medina
robinson medina 2022 年 4 月 12 日
It is rather difficult to understand your problem. Can you post a simplified version of your code to see what is going on?

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

回答 (1 件)

Umang Pandey
Umang Pandey 2023 年 9 月 29 日
Hi Ananta,
As per my understanding, it appears that you're trying to generate a figure within a loop wherein you want to plot a fresh graph in each iteration and save it, but you are not able to do so accurately.
While it is difficult to point out the issue without knowing the specifics of your code, here’s an example on how you can generate a new figure in each iteration and save it:
for i = 1:2000
% Create a new figure
figure;
% Your custom code
% Save the figure
saveas(gcf, sprintf('figure%d.png', i));
% Close the figure to free up memory
close(gcf);
end
Best,
Umang

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by