How to print certain block of Simulink model

조회 수: 2 (최근 30일)
Timo Dietz
Timo Dietz 2018년 11월 22일
댓글: Timo Dietz 2018년 11월 23일
Hello,
I'm trying to get an image of a specific block inside a Simulink model - programmatically.
I tried the following:
1) Save the model to an image file (print command)
2) get position data of model to be shown
Now, cropping the saved image at the blocks position does not work since there is a factor/offset
between position data and the image pixels.
I didn't manage to get the position data for the whole model with which I could evaluate factor/offset between
model height/width and the number of image rows/columns.
I can read the Simulink window location so I tried to set the model to fit the window. With this information and
the screen resolution it should be possible to calculate the needed parameters. But, even though there is
zoomIn/zoomOut and ZoomFactor for the Simulink window, there is no "fit to view" or "fullscreen' command.
Hope, I could explain my point....
Any ideas? Many thanks in advance
Timo

답변 (1개)

Mark McBroom
Mark McBroom 2018년 11월 23일
Rather than trying to locate the block within a larger image, you could simply copy the block into a new model and then take a screen shot of the new model. Use open_system() to create the new model, then add_block to copy block from your original model to newly created model.
  댓글 수: 1
Timo Dietz
Timo Dietz 2018년 11월 23일
Good point. That'll be my backup solution - thank you.
Nevertheless, I'd prefer to have some surroundings also visible, i.e. the block and some context.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Model Editing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by