RTW s function for different behavior
Mostrar comentarios más antiguos
I need to create a simulink block that will behave differently depending on whether I am simulating the model or building code. If I am simulating the model I want the block to pass the input to the output. If I build the code I want the block to take the text from the mask parameters and add a line to the code saying the output is equal to that string content. Any help will be appreciated.
2 comentarios
Kaustubha Govind
el 24 de Jun. de 2013
Simulink does not support strings as the type of a signal, so I don't think you can have a block output a string. Also, are you open to writing an S-function?
Ajit
el 24 de Jun. de 2013
Respuestas (1)
Kaustubha Govind
el 24 de Jun. de 2013
0 votos
To get the alternative behavior, you can write a MATLAB/C S-function with a TLC file. The MATLAB/C code defines the simulation behavior, whereas the TLC defines how the block behaves in generated code. You should also be able to obtain such behavior with the MATLAB Function block by using the output of coder.target to figure out whether the block is simulating or generating code.
1 comentario
Ajit
el 24 de Jun. de 2013
Categorías
Más información sobre Simulink Coder en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!