How can I add a block to a Simulink model in the center of the model view?
12 ビュー (過去 30 日間)
古いコメントを表示
I can add a block to a model using the add_block, but I also want to change the Position parameter of the block to be approximately in the middle of the model. What commands can I use to get the coordinates for the center of the model viewing area?
0 件のコメント
回答 (1 件)
Jesús Zambrano
2020 年 1 月 1 日
Hi S. Boopalam,
Once you hav place the vlock using the command add_block, you can change the position of the block using the command set_param. For example:
vdp
set_param('vdp/Fcn','Position',[50 100 110 120])
To check the coordinates for the center of the model, you can place the block in the center an use the command get_param. For example:
get_param('vdp/Fcn','Position')
Hope this can help to solve your question.
1 件のコメント
Artur Kaminski
2020 年 5 月 14 日
You mean to find out where center is, you have to first manually put a block in the model, and then use get_param on the block to see the position, which would be center? What if I want to find center automatically?
参考
カテゴリ
Help Center および File Exchange で Programmatic Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!