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

2 Ansichten (letzte 30 Tage)
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 Kommentare
Muhammad
Muhammad am 28 Okt. 2022
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?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 28 Okt. 2022
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 Kommentare
Muhammad
Muhammad am 29 Okt. 2022
Bearbeitet: Muhammad am 29 Okt. 2022
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 am 30 Okt. 2022
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Modeling finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by