Is possible to change Sample time in signal builder programmatically?
조회 수: 24 (최근 30일)
이전 댓글 표시
Hi,
I need to change the sample time parameter inside a signal builder block. Manually can be changed in Signal Builder->File->Simulation Options. Using set_param command, I've not found any object paramter that allows to change it. Is there any way to do it?
Thanks.
댓글 수: 1
Tobias Huth
2017년 10월 5일
hey everyone,
as I'm facing the same issue: is there a way to achieve Miguels goal?
- Tobias
채택된 답변
Tobias Huth
2018년 2월 21일
The GUI setting is overridden by setting the sample-time of the 'FromWorkspace' inside the signal builder BUT it is not displayed and one of the masks callbacks sets the value from the menu. Thus the value is set to the one specified on the GUI.
So,yes, there seems to be no way to set these values from a skript...
But thanks for the answer!
- Tobias
댓글 수: 0
추가 답변 (3개)
Arnauld Disableu
2021년 8월 11일
Hello
Facing the same problem I did some research.
No major improvement though. The File/Simulink options GUI is still not updated and still prevails.
Common commands :
figH=get_param(gcb,'UserData'); % with gcb the signal builder block
UD=get(figH,'UserData');
To lauch the GUI :
sigbuilder('simOpts', figH [,UD]); % UD is optionnal. Seems that this function is interested by UD.common.
To set underlying FromWorkspace block parameters :
set_param(UD.simulink.fromWsH, 'SampleTime', '-1')
set_param(UD.simulink.fromWsH, 'OutputAfterFinalValue', 'Holding final value');
set_param(UD.simulink.fromWsH, 'Interpolate', 'off');
To close the signal builder window :
sigbuilder_block('close');
Hope this will help.
Best regards
Arnauld Disableu
댓글 수: 0
ES
2017년 10월 5일
First: Signal Builder is actually a masked from workspace block. So you can find the underlying from workspace block using find_system and then set its 'SampleTime' property.
Second: Apart from storing this info in 'SampleTime' a simulink model also saves the full signal builder data in some obfuscated form inside the model. I think this is what shows in the GUI. This can't be changed in my opinion due to the obfuscation. So the GUI setting is never overridden.
댓글 수: 0
Arun Kumar Misra
2018년 4월 24일
편집: Arun Kumar Misra
2018년 7월 3일
i was able to do this, but this doesn't change value on GUI, but it works set_param(strcat(TH_Model_Name,'/Stimuli/Input_Vectors/FromWs'),'SampleTime',get_param(model,'FixedStep')); set_param(strcat(TH_Model_Name,'/Outputs/Reference_Vectors/FromWs'),'SampleTime',get_param(model,'FixedStep'));
댓글 수: 1
Tobias Huth
2018년 4월 26일
Hello Arun Kumar Misra,
can you please point out, what "Delphi_TH_Model_Name" and the other blocknames (?) in your code snippet refer to? The signal builder block does not have underlying blocks of the names in your answer.
I assume, that you are setting the underlying FromWorkspace's parameter. This works until you open the signal builder block again. When you open the GUI of the signal builder, the parameter set with set_param is reset to the value on the GUI.
So a workaround could be to have a callback (e.g. at model update), that checks the FromWorkspace's sample time parameter and sets it to the desired value, if it it was reset.
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!