Simulink and Memory and Matlab Function Block
21 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Would anyone know how to store muliptle values of data during a simulink program. I have tried to use the Data Store Memeory Block in Simulink, however this only stores one value at any one time and then is updated when it gets a new input. Any ideas?
Also when using Matlab Function blocks is there a way of storing values for later use. For example, is it possible to create an array to store mulitple inputs which you will then process at a later time? (So far I have not managed to do this) Any ideas of how to solve this problem?
0 comentarios
Respuestas (1)
Tong Zhao
el 15 de Mayo de 2022
Editada: Tong Zhao
el 16 de Mayo de 2022
You can use a Memory block outside the MATLAB Function block to store your values, then send the output of the Memory block back into the MATLAB Function block. I know this is not pretty, but easy and fast if you only have a couple of variables to worry about. If you have a large number of data to store, try bundle them into an array if possible, so you don't have to deal with a large number of Memory blocks.
Or if you want the memory to be within the MATLAB Function block for tidyness, you can use persistent variables. A limitation of persistent variable though, is that you cannot use it when your Simulink is running variable step solver.
0 comentarios
Ver también
Categorías
Más información sobre Simulink Functions en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!