Read matrices in s-function only once during startup
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!