Sampletime/rate from mask Initialization

조회 수: 9 (최근 30일)
Peter
Peter 2011년 7월 19일
Hi,
I'm new to MatLab/Simulink an came upon something I could not find the answer. When I use the Simulink Mask posibility I have the "Initialization" code in the Mask Editor. In this code I would like to use the "Inherited" sampletime or samplerate from an input signal.
How can I get this sampletime or samplerate from the input signal in the Initialization code of the Mask.
best regards, Peter

답변 (1개)

Arnaud Miege
Arnaud Miege 2011년 7월 19일
Have you tried:
get_param(gcb,'CompiledSampleTime')
HTH,
Arnaud
  댓글 수: 2
Peter
Peter 2011년 7월 19일
Thanks for the fast reply.
I tried your solution and it worked.
I have however a question about this solution.
The returned time is the "Simulation" sample time of the block. I'm not sure but is there also a Sampletime related to one of the imputs and how can I get that Sampletime.
This would also be needed if therewhere inputs with different sample rates (I think).
Arnaud Miege
Arnaud Miege 2011년 7월 19일
I think the sample time is computed at the block level, see:
http://www.mathworks.com/help/releases/R2011a/toolbox/simulink/ug/brrdmmw-15.html
I'm not sure you can have multiple inputs to a block with different sample times. A good practice would be to use a rate transition block to ensure all inputs to a block have the same sample time.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Sources에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by