Is possible to change Sample time in signal builder programmatically?
21 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Miguel
el 11 de En. de 2012
Respondida: Arnauld Disableu
el 11 de Ag. de 2021
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 comentario
Tobias Huth
el 5 de Oct. de 2017
hey everyone,
as I'm facing the same issue: is there a way to achieve Miguels goal?
- Tobias
Respuesta aceptada
Tobias Huth
el 21 de Feb. de 2018
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 comentarios
Más respuestas (3)
Arnauld Disableu
el 11 de Ag. de 2021
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 comentarios
ES
el 5 de Oct. de 2017
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 comentarios
Arun Kumar Misra
el 24 de Abr. de 2018
Editada: Arun Kumar Misra
el 3 de Jul. de 2018
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 comentario
Tobias Huth
el 26 de Abr. de 2018
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.
Ver también
Categorías
Más información sobre Simulink Environment Customization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!