Simulink.SubSystem.getChecksum - Return checksum of nonvirtual subsystem - MATLAB (original) (raw)
Return checksum of nonvirtual subsystem
Syntax
Description
[[checksum](#bvie4oe-1-checksum),[details](#bvie4oe-1-details)] = Simulink.SubSystem.getChecksum([subsys](#bvie4oe-1-subsys))
returns the checksum of the specified nonvirtual subsystem. Simulink® computes the checksum based on the subsystem parameter settings and the blocks the subsystem contains. Virtual subsystems do not have checksums.
One use of this command is to determine why code generated for a subsystem is not being reused.
Note
Simulink.SubSystem.getChecksum
compiles the model that contains the specified subsystem, if the model is not already in a compiled state. If you need to get the checksum for multiple subsystems and want to avoid multiple compiles, use the command , _`model`_([], [], [], 'compile')
to place the model in a compiled state before usingSimulink.SubSystem.getChecksum
.
This command accepts the argument subsys
, which is the full name or handle of the nonvirtual subsystem block for which you are returning checksum data.
Examples
Run the function Simulink.SubSystem.getChecksum
on the model GeneratedCodeFunctionReuse
. In the MATLAB® editor window, both output structures are displayed. In the workspace pane, double-click either of the structures to view its contents.
Load the model GeneratedCodeFunctionReuse
.
openExample('GeneratedCodeFunctionReuse')
Select subsystem SS1
and execute the follow line of code in the MATLAB editor to get the full name and path to the subsystem SS1:
Run the function getChecksum
on the subsystem with the following command:
[chksum1, chksum1_details] = Simulink.SubSystem.getChecksum(path_ss1)
The output structures chksum1
andchksum1_details
will store the output of thegetChecksum
function call.
chksum1 =
struct with fields:
Value: [4×1 uint32]
MarkedUnique: 0
chksum1_details =
struct with fields:
ContentsChecksum: [1×1 struct]
InterfaceChecksum: [1×1 struct]
ContentsChecksumItems: [359×1 struct]
InterfaceChecksumItems: [60×1 struct]
Input Arguments
Input the full name of the nonvirtual subsystem for which you want to calculate the checksum.
Data Types: char
Output Arguments
Checksum information, returned as a structure with the fields:
Value – 4x1 uint32
– Array of four 32-bit integers that represents the subsystem's 128-bit checksum
MarkedUnique – bool
– True if the subsystem or the blocks it contains have properties that would prevent the code generated for the subsystem from being reused; otherwise, false
Checksum information, returned as a structure with the fields:
ContentsChecksum – structure
– A structure of the same form as checksum
, representing a checksum that provides information about all blocks in the system.
InterfaceChecksum – structure
– A structure of the same form aschecksum
, representing a checksum that provides information about the subsystem's block parameters and connections
Structure array returned with the following fields:
Handle – char array
Object for which Simulink added an item to the checksum. For a block, the handle is a full block path. For a block port, the handle is the full block path and a character vector that identifies the port.
Identifier – char array
– Descriptor of the item Simulink added to the checksum. If the item is a documented parameter, the identifier is the parameter name
Value – type
– Value of the item Simulink added to the checksum. If the item is a parameter,Value
is the value returned byget_param
(handle
,identifier
).
Structure array returned with the following fields:
Handle – char array
Object for which Simulink added an item to the checksum. For a block, the handle is a full block path. For a block port, the handle is the full block path and a character vector that identifies the port.
Identifier – char array
– Descriptor of the item Simulink added to the checksum. If the item is a documented parameter, the identifier is the parameter name
Value – type
– Value of the item Simulink added to the checksum. If the item is a parameter,Value
is the value returned byget_param
(handle
,identifier
).
Version History
Introduced in R2006b