How can I set a Block-parameter value that is a Simulink.Signal contained in a struct?
1 view (last 30 days)
I have a simulink model with some Blocks which some of their parameters are Simulink.signals. I want get this signals, save them in a structure in the workspace and set they again. I did following:
parameterNames = fieldnames(get_param(BLOCK,'DialogParameters'))
parameterValues = cellfun(@(x) get_param(BLOCK,x),parameterNames,'UniformOutput', false)
for i = 1:numel(parameterNames)
% some of the values are Simulink.signals
oldParameterValue = parameterValues(i)
% save the Simulin.signal in a struncture in workspace
newVarName = ['Structure.Signal' int2str(i)]
% set the new value
The previous code results in an error. I found that for Simulink.signals, the value need to be given inside ' '. Thus
However, 'newVarName' is not my signal, therefore I changed to
Then, I become a error, that the name is not a allowed value name. I checked the error, and I found that the problem is that the new variable name has a point "Structure.Signal".
Please help me to set this new signal.