Simulink.ModelReference.ProtectedModel.HookInfo - Files and exported symbols generated by creation of protected model - MATLAB (original) (raw)
Main Content
Files and exported symbols generated by creation of protected model
Description
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 accepts a Simulink.ModelReference.ProtectedModel.HookInfo
object as input. When you protect your model, use the ‘CustomPostProcessingHook
’ option of theSimulink.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 as input.
Properties
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, theHookInfo
object cannot provide information on exported symbols.
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.
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.
Examples
- 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 inputs theSimulink.ModelReference.ProtectedModel.HookInfo
object that was generated for the protected model.
openExample('sldemo_mdlref_counter');
Simulink.ModelReference.protect('sldemo_mdlref_counter',...
'Mode', 'CodeGeneration',...
'CustomPostProcessingHook',...
@(protectedMdlInf)pm_postprocessing(protectedMdlInf))
Version History
Introduced in R2014a