1
votes

Since I do this quite often, I would like to create a keyboard shortcut to change the property of a Simulink Signal to enable the checkbox "Signal name must resolve to Simulink signal Object".

Like this blog post suggests, I created my sl_customization file and have the following code in the callback function, which works fine to make Test Points (also a checkbox in the Signal Properties dialog):

function makeResolveToSimulinkObjcb(~)
line = find_system(gcs, 'SearchDepth', 1, 'FindAll', 'on', ...
          'Type', 'line', 'Selected', 'on');
signalObj=get_param(line(1),'Object');
set(signalObj,'TestPoint',1);
end

Any ideas what the parameter name is for this option, instead of 'Test Point'? I didn't find anything in the documentation...

1
Hacking Matlab. I like it.Ander Biguri

1 Answers

4
votes

The property you want is MustResolveToSignalObject, but for that to work the signal must have a name. So you want something like,

set(signalObj,'SignalNameFromLabel','MySignalName');
set(signalObj,'MustResolveToSignalObject',1);