Bug in matlab's builtin sort routine
Show older comments
Matlab's 2012b has introduced all sorts of bugs in its sort routine. Consider the following
syms d1_X1_f1 d1_X1_f2 d1_X2_f1 d1_X2_f2 d1_b1_f1 real
A = sort([d1_X1_f1, d1_X1_f2, d1_X2_f1, d1_X2_f2, d1_b1_f1 ])
A'
In R2011a, this is correctly sorted as
d1_X1_f1
d1_X1_f2
d1_X2_f1
d1_X2_f2
d1_b1_f1
But in R2012b, we get
d1_X1_f1
d1_X1_f2
d1_X2_f1
d1_b1_f1
d1_X2_f2
There is at least one other bug that I've discovered, which I've been able to work around, but this one is really nasty. Does anybody have out there a sort algorithm that works properly? Since sort is a builtin, I can't just pull in the file from my 2011a distribution.
Any advice would be appreciated!
3 Comments
Andreas Goser
on 25 Jan 2013
Did you report the bugs to MathWorks? It is important you do that even if you have a workaround yourself. I too often dealt with users being angry "why didn't you fix this bug in the last years!?!?" and they never reported the bug. Believe it ot not, but the majority of bugs is just found by one or two users - and that with far more than a million users!
Leo Simon
on 25 Jan 2013
Andreas Goser
on 25 Jan 2013
Hope is not a strategy ;-) I researched and the bugs are fixed. I will contact you by email for additional information.
Answers (2)
Walter Roberson
on 25 Jan 2013
If you use
T = [d1_X1_f1, d1_X1_f2, d1_X2_f1, d1_X2_f2, d1_b1_f1 ];
which sort(T)
I suspect you will find that a symbolic toolbox sort.m is used (but that file might call into MuPAD)
Leo Simon
on 25 Jan 2013
0 votes
1 Comment
Andreas Goser
on 28 Jan 2013
Worked with the customer offline. If another customer runs into this and calls Technical Support, refer to "G906530"
Categories
Find more on Code Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!