Is possible to change Sample time in signal builder programmatically?
21 次查看(过去 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!