visdiff, Can you include a tolerance?
显示 更早的评论
I'm trying to use visdiff to compare the output of two versions of a software, and make sure that the changes I made are not altering the result. I've saved the outputs to a .mat file and have several different .mat files which I would like to compare to their corresponding previous versions.
The problem is visdiff will return variables not matching even if they are very close. I would like to find some way to compare the two files, while allowing for a tolerance. For instance, the following two numbers are pulled from corresponding .mat files from the two versions, and visdiff says they're "different"
Old Version: 84.972465581755998 New Version: 84.972465581758897
My application is not concerned with how well these match at the 12th decimal point.
Thanks for any help!
JR
采纳的回答
更多回答(1 个)
Walter Roberson
2011-6-27
0 个投票
What datatypes need to be compared? You will have trouble with objects, handle graphics, anonymous functions, or inline functions.
If the .mat files include structures, you will need to define whether the output should be considered the same if the numeric values are "close enough" but the field order is different.
If your files can include the integer datatypes such as uint16, then you will need to define what is "close enough" for them.
Is "close enough" to be defined in absolute terms, or should it be defined relatively, perhaps in multiples of eps() of the values?
If you have single precision values, how would you like to compare those?
2 个评论
Walter Roberson
2011-6-27
Do the variable names have to be in the same order in the .mat file?
John Robinson
2011-6-27
类别
在 帮助中心 和 File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!