Bug in matlab's builtin sort routine

조회 수: 1 (최근 30일)
Leo Simon
Leo Simon 2013년 1월 25일
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
Leo Simon
Leo Simon 2013년 1월 25일
I did report this, and a related one due to symbolic sorting. Hopefully they'll do something about it.
Andreas Goser
Andreas Goser 2013년 1월 25일
Hope is not a strategy ;-) I researched and the bugs are fixed. I will contact you by email for additional information.

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2013년 1월 25일
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
Leo Simon 2013년 1월 25일
I guess I've found my own workaround, which is incredibly unsatisfactory, but does seem to work. Convert the symbolic array to a cell array of strings, then sort, then convert back to syms. Uggh, I feel ill just typing this....
  댓글 수: 1
Andreas Goser
Andreas Goser 2013년 1월 28일
Worked with the customer offline. If another customer runs into this and calls Technical Support, refer to "G906530"

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by