Read matrices in s-function only once during startup
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to read some matrices in an s-function, which are originally loaded in the workspace. I would like to do this only once during startup while keeping the execution time as low as possible. Do you may know which solution is the most efficient? Till now, I am considering one of the following three alternatives:
1) Load the matrices as inputs in the s-function. I think that this is the least efficient way because at every sampling period the s-function has to read their values.
2) Include them as parameters. In this case I am not sure if matlab reads the parameters only once during startup (which would be the ideal case) or if it repeatedly access them at every sampling period. This document seems to suggest that this is done only once, but I am not really sure.
3) Use mexGetVariablePtr at MDL_START to read the variables directly from workspace. I am not really familiar with this solution but I had encountered it once and it seemed to be a valid alternative.
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Naming Conventions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!