MATLAB: How to add port label to the Simulink block within C MEX

port label simulink c mexsimulink

Dear All,
I'm looking for a solution how can I add a port label to my Simulink block within my C MEX S function.
The number of the outputs depends on a masked parameter, so I can't define it at the mask statically. I'd like to have similar guise: http://www.mathworks.com/help/simulink/slref/port_label.html
I've checked this one, but It's not working: http://www.mathworks.com/matlabcentral/answers/31360
Kind regards,
Daniel

Best Answer

If the port label depends on a mask parameter, it should be possible to do it in the mask, not in the S-Function.
I do not have an example to do exactly what you are looking for, but the Mask Drawing command has access to mask parameters So it should be possible to write mask drawing commands to achieve what you are looking for.
In R2012b, we have added a new set of examples to show typical things done in masks:
We also have a series of posts on masking here:
Those two links should give you some inspiration to implement what you are looking for.