How to use set_param(BlockX, 'SampleTime') during runtime of Simulink?
이전 댓글 표시
Dear Community,
i know the topic of how to use set_param() to change params of chosen Simulink Blocks is well discussed, but I couldn't get an answer to this:
As the pictures show, I got a sin(x) signal, doing 3 periods wth a certain frequency before i got another iteration with higher frequency and so on. This goes from 0.1mHz to 1kHz and I want to have 600 samples per period. Meaning that I want to change the sample time of the "Signal Editor" Block everytime I go to a higher frequency. Therefore I want the sample time to be 1/(SamplesPerPeriod*CurrentFrequency).
The counter and the matlab-fcn only get relevant when the frequency jumps to the higher value and tries to update the sample time by:
set_param('SineTest/Signal Editor','SampleTime',SampleTime_new);
But it says that it 'cannot change parameter 'Sample Time' of Signal Editor while simulation is running' How do i solve this? Is there a way that i can change it during runtime or tell Simulink to pause, change it and resume?
Thanks for your help in advance :)
Best wishes
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 General Applications에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!