필터 지우기
필터 지우기

How do I change drop - down value of a block in Simulink model for my simulation input object?

조회 수: 8 (최근 30일)
How do I change drop - down value of a block in a simulink model for my simulation input object? I can't use set_param as it is not supported for deployment.
I want to be able to produce a stand-alone from it.
  댓글 수: 2
Muhammad
Muhammad 2022년 10월 28일
It can be any block containing drop - down options. I want to switch between those options for simulation input object. See I am trying to package simulink model inside app designer app (deployable) and want to give user options to change drop - down values in my model through app.
For my case, I would like to change options of SI or Diesel engine in engine block. Another instance lies in changing drive cycles in relevant drop - down present in drive cycles source block. And probably many more!
If it helps to be more specific, for discussion, we can take a simple example of mass spring damper model shipped with simulink compiler. Command is:
openExample('simulinkcompiler/DeployingASimulationAppUsingSimulinkCompilerExample')
Now lets say we want to add option in app for user to change drop - down value ( for element - wise or matrix multiplication) in the gain block (named 'Mass') of model. How should we do it?

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

채택된 답변

Fangjun Jiang
Fangjun Jiang 2022년 10월 28일
For changes like this, if you do it manually, meaning changing from 'Element-wise(K.*u)' to 'Matrix(K*u)', the Simulink model is changed. In other words, if you want to do it programingly, you have to use set_param('Block','Multiplication','Matrix(K*u)'). This is not something that can be done by setting up simulation input object.
  댓글 수: 2
Muhammad
Muhammad 2022년 10월 29일
편집: Muhammad 2022년 10월 29일
Dear MathWorks, This is a very strong limitation (at least, in my experience) in simulink compiler and work should be done to remove it. Regards!
Fangjun Jiang
Fangjun Jiang 2022년 10월 30일
A workaround could be developed using the variant subsystems. Use a workspace variable to control the variants, one uses the 'Element-wise(K.*u)' Gain block, the other uses the 'Matrix(K*u)' Gain block.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by