필터 지우기
필터 지우기

Is it possible to add a "configurable subsystem" in a library using add_block command ?

조회 수: 1 (최근 30일)
Hi,
I am trying to automatically create library parsing some text file. It works pretty good.
Of course I use add_block and set_param functions.
Now I am trying to add "configurable subsystem" in my library (using add_block) but it does not work...
Is it impossible ?
Does somebody now a way to do it ?
Thank you,
Arnaud Bonneuil

채택된 답변

Bonneuil Arnaud
Bonneuil Arnaud 2012년 8월 10일
편집: Bonneuil Arnaud 2012년 8월 10일
Hi,
here is a piece of code I use :
function test_add()
model = bdroot(gcb);
config_subsystem = strcat(model, '/config_subsystem');
add_block('configurable_subsystem/template',config_subsystem,...
'Position', [480, 104, 580, 146]);
set_param(config_subsystem,'MemberBlocks', 'config_1, config_2, config_3');
set_param(config_subsystem,'BlockChoice', 'config_1');
end
I put a configurable subsystem named "template" in a library named "configurable_subsystem.mdl". "template" block is not configured.
I can add it to my library (it contains 3 subsystems named "config_1", "config_2", "config_3") but I can not configure it.
error message is :
??? Error using ==> set_param Cannot set member block list for configurable subsystem instance 'my_lib/config_subsystem'.
Error in ==> test_add at 10 set_param(config_subsystem,'MemberBlocks', 'config_1, config_2, config_3');
Thank you for help.
  댓글 수: 1
Bonneuil Arnaud
Bonneuil Arnaud 2013년 1월 28일
Hi,
I found solution a few mounth ago. I write it here.
The configurable subsystem in the source library should have the parameter "TemplateBlock" set to "master" instead of "self".

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

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 8월 9일
  1. can you writte the code that did'nt work
  2. what is the error message
  3. here my code to add a configurable subsystem named "sub1" to a lib named "answer_lib" from a model named "model1"
add_block('model1/sub1', 'answer_liib/sub1') ,

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by