Main Content

Simulink.SubSystem.getChecksum

Return checksum of nonvirtual subsystem

Description

[checksum,details] = Simulink.SubSystem.getChecksum(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 using Simulink.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.

example

Examples

collapse all

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:

path_ss1 = gcb

Run the function getChecksum on the subsystem with the following command:

[chksum1, chksum1_details] = Simulink.SubSystem.getChecksum(path_ss1)

The output structures chksum1 and chksum1_details will store the output of the getChecksum 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

collapse all

Input the full name of the nonvirtual subsystem for which you want to calculate the checksum.

Data Types: char

Output Arguments

collapse all

Checksum information, returned as a structure with the fields:

Value4x1 uint32 – Array of four 32-bit integers that represents the subsystem's 128-bit checksum

MarkedUniquebool – 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:

ContentsChecksumstructure – A structure of the same form as checksum, representing a checksum that provides information about all blocks in the system.

InterfaceChecksumstructure – 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:

Handlechar 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.

Identifierchar array – Descriptor of the item Simulink added to the checksum. If the item is a documented parameter, the identifier is the parameter name

Valuetype – Value of the item Simulink added to the checksum. If the item is a parameter, Value is the value returned by get_param(handle, identifier).

Structure array returned with the following fields:

Handlechar 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.

Identifierchar array – Descriptor of the item Simulink added to the checksum. If the item is a documented parameter, the identifier is the parameter name

Valuetype – Value of the item Simulink added to the checksum. If the item is a parameter, Value is the value returned by get_param(handle, identifier).

Version History

Introduced in R2006b