pmb
pmb

Reputation: 876

Simulink shortcut to resolve signal name

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...

Upvotes: 1

Views: 1947

Answers (1)

Phil Goddard
Phil Goddard

Reputation: 10782

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);

Upvotes: 4

Related Questions