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

4 visualizaciones (últimos 30 días)
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 comentarios
Muhammad
Muhammad el 28 de Oct. de 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?

Iniciar sesión para comentar.

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 28 de Oct. de 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 comentarios
Muhammad
Muhammad el 29 de Oct. de 2022
Editada: Muhammad el 29 de Oct. de 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 el 30 de Oct. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by