define variable value in simulink model
Mostrar comentarios más antiguos
Hi,
I use variable 'L' inside gain block.
How can I define the value for 'L' without using the command window in Matlab? I want the user can edit the variable value In the model, something like in the added image. <<

>>

Thank you!
Respuesta aceptada
Más respuestas (2)
ES
el 7 de Ag. de 2017
0 votos
Instead of a Gain, use a divide(product) block. First argument is the signal, Second will be from a data store read (the pair of data store write).
1 comentario
yoni stein
el 9 de Ag. de 2017
Reid Spence
el 22 de En. de 2024
0 votos
It depends on what is meant by "the user can edit the variable value In the model". If you want the user to be able to directly modify L on the block, then you can create a mask for the block and make "L" a mask parameter. Now "L" is modifyable directly on the block dialog.

In the picture you show a Constant block feeding into a Datastore Memory block. In most cases, we would not recommend setting the value of a parameter (like L), with the value of a signal (like the output of a constant block). See the page below for the difference between parameters and signals, and how to use the parameter writer block if you really need to do this.
Categorías
Más información sobre Signal Import and Export en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!