import constants to simulink
Mostrar comentarios más antiguos
I want to import some constants values from workspace to simulink.
For example i will write A=10, B=7, C=8 in an m.file then i will run it. So, it will be loaded to my work space.
How can i import them to Simulink ?? From workspace block give me an error message 'Invalid matrix-format ...'
Respuesta aceptada
Más respuestas (2)
Mischa Kim
el 25 de Feb. de 2015
1 voto
Ameen, a standard approach is through callbacks. In your Simulink model go to > File > Model Properties > Model Properties, navigate to the Callbacks tab and add commands as necessary. See the documentation for more detail.
3 comentarios
ameen
el 25 de Feb. de 2015
Mischa Kim
el 25 de Feb. de 2015
Editada: Mischa Kim
el 25 de Feb. de 2015
You can simply assign the values for A, B, etc. in the InitFcn callback. Treat the text window just like you would work in the MATLAB command window. Alternatively, you can execute scripts, if you need to load more stuff.
ameen
el 25 de Feb. de 2015
Saburi Ashtekar
el 2 de Feb. de 2018
0 votos
a=10 b=20
Categorías
Más información sobre Model, Block, and Port Callbacks 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!