Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
oceanmod
oceanmod am 27 Mai 2020
Kommentiert: Rik am 27 Mai 2020
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 Kommentare
oceanmod
oceanmod am 27 Mai 2020
But that wouldn't make any sense. The number of contours should not change depending on the version number (obviously).
Rik
Rik am 27 Mai 2020
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).

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by