Checksum of file


checksum = Simulink.getFileChecksum(filename)



checksum = Simulink.getFileChecksum(filename) returns the checksum of the specified file, using the MD5 checksum algorithm. Use the checksum to see if the file has changed compared to a previous checksum. You can use checksums as part of an audit trail.

Use Simulink.getFileChecksum to get a checksum for any file. If the file contents do not change from one checksum to the next, the checksum from Simulink.getFileChecksum stays the same. Otherwise, the checksum is different with each change to the file contents.

For functional information on a model, use Simulink.BlockDiagram.getChecksum instead. Simulink.BlockDiagram.getChecksum looks at the functional aspect of the model. If the functional aspect doesn't change, then Simulink.BlockDiagram.getChecksum returns the same checksum.

For example, if you moved a block, the file contents are different (measured by Simulink.getFileChecksum) but the function of the model is unchanged (measured by Simulink.BlockDiagram.getChecksum).


collapse all

Use fullfile to specify a full path to a file and get the checksum.

filechecksum = Simulink.getFileChecksum(fullfile(matlabroot,'toolbox',...

Input Arguments

collapse all

File name to get checksum for, with file extension and optional full path. Use fullfile to specify a full path to a file, or use the form 'C:\Work\filename.mat'.

Example: 'lengthofline.m'

Data Types: char

Output Arguments

collapse all

Checksum value in a 32-character vector.

Introduced in R2014b

Was this topic helpful?