Main Content


Return checksum of nonvirtual subsystem



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


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.


collapse all

Run the function Simulink.SubSystem.getChecksum on the model rtwdemo_ssreuse. In the MATLAB editor window, both output structures are displayed. In the workspace pane, double-click on either of the structures to view its contents.

Load the model rtwdemo_ssreuse.


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:

Checksum information, returned as a structure with the fields:

Structure array returned with the following fields:

Structure array returned with the following fields:

Introduced in R2006b