Bizarre errors with contour command (matlab 2014a vs later versions)

조회 수: 2 (최근 30일)
oceanmod
oceanmod 2020년 5월 27일
댓글: Rik 2020년 5월 27일
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
oceanmod
oceanmod 2020년 5월 27일
But that wouldn't make any sense. The number of contours should not change depending on the version number (obviously).
Rik
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 CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by