MATLAB: Selection of logging signals in Models causes problems if used in libraries

libraryloggingsignalsimulink

I have a Simulink block in my main model from a linked library. When I try disabling Simulink Signal Logging on only one signal from the block, then signal logging will be automatically be activated again on the same Block but on another output port.
I tried to break the link of the Subsystem to the Library, but that did not help to fix the behavior.

Best Answer

We have disabled logging controls inside libraries so that you MUST log in the model and not the library. For compatibility, we still support APIs for logging in library.

The problem in this case is that logging is already enabled in the library. That means even if you turn it off in the model, the next time you load the model the logging settings get re-applied from the library. That is to support loading models in earlier releases.

To fix the problem, first you need to disable all logging in the library:

set_param('LIB01', 'InstrumentedSignals', [])  %LIB01 is the name of the Library where the Block is stored and linked to your main model.

Now you can save the library and reopen them model. To workaround the problem, you may need to first remove all redundant logging settings in the model in the same way:

set_param('MOD01', 'InstrumentedSignals', [])  %MOD01 is the name of your main model where you have linked the Blocks fron the Libraries LIB01, LIB02 etc..

After doing this, you should be able to log and unlog signals in the model, including those within library instances without any problems.