MAT-File

Viewer

Primitives

DiffPlug can display the following primitives:

  • rgb images saved as arrays (array must type UInt8 with 3 dimensions, where the 3rd dimension has length 3)
  • 2D numeric arrays of any type (floating point, integer, logical, sparse, or complex)
  • string values

MAT-File viewer primitives

Breaking down structs and cell arrays

When DiffPlug encounters a scalar struct or object, it lists out every field recursively.

However, when DiffPlug encouters a cell array or an array of struct, it might be that listing out every single value is too verbose. To address this, DiffPlug wil display the entirety of the first few values, but then show an ellipsis for the rest.

MAT-File viewer struct and cell decomposition

Differ

What is shown

DiffPlug compares all entries within the MAT-File, and then shows you only the entries which have changed.

Folder differ screenshot

Additions and removals

When a value has been added or removed, DiffPlug displays the removed structure recursively within a scroll view, so that you can understand the full context of the change.

Folder differ screenshot

Compatibility

DiffPlug is fully compatible with Mathworks® MATLAB® MAT-File format versions v6 and v7.

  • v6 is the default format from R8 to R13
  • v7 is the default format from R14 to present
  • v7.3 is not supported by DiffPlug, and MATLAB does not export to v7.3 by default. See the Mathworks® website for more details.

Default fields of objects (not structs)

Storing and retrieving structs with .mat and .sldd is straightforward. For objects however, there is the additional complication of the "class" of the object.

For the purposes of diffing, the only thing that really matters are the field values. However, some objects have default values which are used in case those fields have not been defined, and these default values are not always stored into the .mat or .sldd (but sometimes they are!)

For example, Simulink.Bus objects have a field PreserveElementDimensions. If you set that field to true, it will always be stored in the file. If you set that field to false, it might be stored in the file, or it might just not be in the file at all. DiffPlug knows about Simulink.Bus, so we automatically supply the default value when it is not specified, but our library of classes is incomplete.

In practice this is a minor issue - if a field of an object (especially a built-in object) has changed then you know it has really changed. If it has instead been added or removed, then it is possible that a default value which DiffPlug doesn't know about has not been supplied.

This is a rare case, but if you see one please send us a screenshot so that we can update our library.