필터 지우기
필터 지우기

Read matrices in s-function only once during startup

조회 수: 2 (최근 30일)
jpro89
jpro89 2018년 4월 16일
편집: jpro89 2018년 4월 16일
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개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by