필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Import constant array in s-function - Avoid repetitive import of array in each step

조회 수: 2 (최근 30일)
jpro89
jpro89 2017년 4월 5일
마감: MATLAB Answer Bot 2021년 8월 20일
In a level-2 c s-function, at each sampling time I would like to access part of a rather large but constant matrix. To my understanding, there are two approaches I could use, where both are calling this matrix in the mdlOutputs function.
1) Import it as an input. I think that in this case I will increase the computational time because I have to import it repeatedly in every sampling step.
2) Import it as a parameter. In this case I still have to read it in the mdlOutputs, so I do not think that I will achieve anything better compared to the previous approach (I might be wrong though).
Is there any way to avoid first loading the whole matrix and then picking the part that I need to process? And in general, which would be the most efficient way to implement it?
  댓글 수: 3
jpro89
jpro89 2017년 4월 5일
Indeed there is one. But to do so, the approach that I have in mind is to copy the matrix itself in the s-function script, which is not really possible due to the big size of the matrix.
Walter Roberson
Walter Roberson 2017년 4월 5일
engGetVariable during the initialization phase?
If you find it necessary to import it as a "signal" then the signal could be set to the full value at time 0 and could be set empty (or trivial) at all other times and you would ignore the value except during initialization.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by