This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Make postprocessing customizations when building custom block library




sl_postprocess(h) takes a handle to the custom block library, h, and allows you to make library postprocessing customizations (for example, add a forwarding table (Simulink)).

If a Simscape™ file package being built contains a sl_postprocess.m file, then ssc_build calls sl_postprocess once the block library (package_name_lib) is generated but before it is saved to disk. If sl_postprocess generates an error, the library does not build.

You can include a sl_postprocess.m file at any level in the library package. At the top level, it makes postprocessing changes to the whole custom block library. Similarly, if the sl_postprocess.m file resides in a sublibrary in the package, it takes a handle to that sublibrary and makes the corresponding changes.


If you rename a block or change a parameter name, you need to add a forwarding table to update old models that reference the block. However, if you manually add a forwarding table to a custom library, it will get overwritten every time you rebuild the library. Instead, include a sl_postprocess.m file in the library package, which will add the forwarding table automatically upon rebuilding the library:

- +MySimscape 
|-- sl_postprocess.m 
|-- +Mechanical 
| |-- spring.ssc 
| |-- ...

The sl_postprocess.m file contains a forwarding table:

function sl_postprocess(h)
% Forwarding table for the spring block
ft = { {'MySimscape_lib/Mechanical/Ideal Spring', 'MySimscape_lib/Mechanical/Rotational Spring'} }
set_param(h, 'ForwardingTable', ft);

This forwarding table indicates that the custom block name for the spring.ssc component has changed from 'Ideal Spring' to 'Rotational Spring'.

Note that if you have customized the library names using lib.m files, you have to use these custom names in the forwarding table (for example, 'Mechanical Library' instead of 'Mechanical').

See Also

Introduced in R2010a

Was this topic helpful?