How to add_block Sum of Elements instead of Sum block ?

조회 수: 3 (최근 30일)
Henry Buck
Henry Buck 2017년 4월 22일
답변: Rajanya 2025년 2월 12일 6:04
Hi, By using this lines Sum block is created:
Add_sum=add_block('built-in/Sum', [mdl,'/sum_elem']);
posg = get(Add_sum,'Position');
set(Add_sum,'Position',posg + [1970 1736 1980 1756])
PH_Add_sum=get(Add_sum,'PortHandles');
It has two input and one output.
Is there a similare way to create Sum of Elements - which has one input and one output ?
Thanks for your help, Henry

답변 (1개)

Rajanya
Rajanya 2025년 2월 12일 6:04
You can set the 'Inputs' parameter of the 'Sum' block to just '+', which will make the block function as a 'Sum of Elements' block - refer here.
Adding the following line in your code will configure the 'sum_elem' block to function as a 'Sum of Elements' block:
set_param(Add_sum, 'Inputs', '+');
Hope this answers your question!

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by