Files and exported symbols generated by creation of protected model
Information about files and symbols generated when creating a protected model.
You can use this information for postprocessing of the generated files prior to
packaging. To access the properties of this class, create a postprocessing function that
Simulink.ModelReference.ProtectedModel.HookInfo object as input. When you
protect your model, use the ‘
CustomPostProcessingHook’ option of the
Simulink.ModelReference.protect function to
specify the postprocessing function. Prior to packaging the protected model, the
postprocessing function is called with the
Simulink.ModelReference.ProtectedModel.HookInfo from the protected model
ExportedSymbols— Exported Symbols
A list of exported symbols generated by a protected model that you must not modify, returned as a cell array of character vectors.
For a protected model with a top model interface, the
HookInfo object cannot provide information on
NonSourceFiles— Nonsource code files
A list of nonsource files generated by protected model creation, returned as a cell array of character vectors. Nonsource files include MAT, RSP, and PRJ files.
SourceFiles— Source code files
A list of source code files generated by protected model creation, returned as a cell array of character vectors. Source files include C, H, CPP, and HPP files.
On the MATLAB® path, create a postprocessing function
pm_postprocessing.m that contains this code:
function pm_postprocessing(hookInfoObject) s1 = 'Exported Symbols: '; symbols = hookInfoObject.ExportedSymbols; s2 = 'Source Files:'; srcfiles = hookInfoObject.SourceFiles; s3 = 'Non-Source Files:'; nonsrcfiles = hookInfoObject.NonSourceFiles; disp([s1 symbols]) disp([s2 srcfiles]) disp([s3 nonsrcfiles])
This function displays a list of the exported symbols, source code files, and nonsource files generated by the model protection process.
Protect the model
sldemo_mdlref_counter and specify the
postprocessing function that you created. Before packaging the generated
files, the model protection process calls the postprocessing function and
object that was generated for the protected model.
Simulink.ModelReference.protect('sldemo_mdlref_counter',... 'Mode', 'CodeGeneration',... 'CustomPostProcessingHook',... @(protectedMdlInf)pm_postprocessing(protectedMdlInf))