MATLAB: Does the signal description fail to show up when I use GET_PARAM on an input port or a line object in Simulink

descriptionget_paraminportlineoutportporthandlesignalsimulink

I want to write a MATLAB file that can read the description of the input lines (signals) to a given block. When this block is the current block, I use the following commands:
a = get_param(gcb, 'PortHandles');
b = get_param(a.Inport, 'Description');
This always yields an empty string 'b', despite my having entered a description for that line (signal).

Best Answer

The following set of commands will yield the signal description once you have selected the signal in your Simulink model:
a = get_param(gcb,'PortHandles');
line = get_param(a.Inport,'Line');
Srcport = get_param(line, 'Srcporthandle');
b = get_param(Srcport, 'Description')