Bizarre errors with contour command (matlab 2014a vs later versions)
1 次查看(过去 30 天)
显示 更早的评论
I have some legacy codes that worked fine with 2014a and earlier versions. As we all know, 2014b and later versions changed things a lot, leading to lots of broken codes.
I am getting some weird errors running this line of code in 2014a and 2017a:
% 'grid' and 'diag' are structural variables. The line below is finding the contours of some 2d field (diag.sla)
% for a particular contour value (15)
cont_km = contour(grid.xkm, grid.ykm, diag.sla, [15.0 15.0]) ;
When I run this command in 2014a and 2017a, I get different results as cont_km has different sizes. That is, 2017a is identifying a different number of contours for the same field at the same contour level on the same grid!
I have checked the input variables grid.xkm, grid.ykm, diag.sla are identical when I run the command in both the versions.
Did mathworks change how the contour command works after 2014a?
Any help is appreciated.
3 个评论
Rik
2020-5-27
Contour plots are not an exact science. If you had found a difference between the values that sqrt returns, then you would have found a bug in one or both versions.
Even a function like imclose can change behavior in edge cases (in the case of this function quite literally).
If you want thing to be stable between releases you will have to do a lot yourself, which is going to cost a lot time (design time, execution time, or both).
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!