Simulink block diagram to figure

4 ビュー (過去 30 日間)
Prestonr
Prestonr 2024 年 4 月 12 日
編集済み: Prestonr 2024 年 4 月 12 日
Hello,
I would like to take a snapshot of a simulink block diagram and display it as a figure. Is this possible?

回答 (1 件)

Benjamin Thompson
Benjamin Thompson 2024 年 4 月 12 日
編集済み: Benjamin Thompson 2024 年 4 月 12 日
If you go to the Simulink Format tab, there is a screen shot option. That will send the current Simulink view into the clipboard as a bitmap or windows metafile. Copy that into a graphics tool like Paint, save it as an image file. Then use imshow to display it in a MATLAB figure window.
  1 件のコメント
Prestonr
Prestonr 2024 年 4 月 12 日
編集済み: Prestonr 2024 年 4 月 12 日
Hey @Benjamin Thompson, I am currently able to do that using the following method:
function create_model_figure(model_name)
temp_pic_filename = strcat('tmp_', model_name);
print(strcat('-s', model_name), '-dpng', temp_pic_filename)
temp_pic = imread(strcat(temp_pic_filename,'.png'));
imshow(temp_pic)
delete(strcat(temp_pic_filename,'.png'))
end
However, I'd like to go directly to a model figure without having to make an temporary image file to accomplish this.

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

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by