MATLAB provides a built-in function called compareVersions
to compare two workspace variables. This function returns a structure of type matsamecore
which specifies the location and value of any differences between the two variables.
Here's an example usage:
main.m284 chars14 lines
Output:
main.m32 chars2 lines
In the above code, A
and B
are two variables being compared. result
variable contains the result of comparison. If result.areSame
returns true then the two variables are identical, else they differ at result.differIndex
.
gistlibby LogSnag