Changes in STRNCMP
이전 댓글 표시
When did STRNCMP change its behaviour?
Matlab 2009a:
strncmp('asd', 'qwe', 0) % >> 0
Matlab 2011b:
strncmp('asd', 'qwe', 0) % >> 1
And in general: What is an efficient way to determine the release, when a function was changed?
[EDITED] 30-Sep-2011, 06:48 UTC
Matlab 2009a:
strncmp('a', 'a', 2) % >> 0
Matlab 2011b:
strncmp('a', 'a', 2) % >> 1
There are good arguments for the one and the other reply. But there are no good arguments for changing the behaviour of such elementary functions. It affects about 40.000 lines of my code, which directly and indirectly depends on the replied values.
I'm trying to migrate from 2009a to 2011b and this first problem stopped the tests after 3 minutes only. And there is no really convenient way to find a description when and why STRNCMP has changed. Even the bug-report is misleading:
STRNCMP and STRNCMPI return FALSE when comparing cell arrays and
considering 0 characters (i.e., with the third input set to zero).
No, it does not concern only cell arrays, but CHAR vectors also.
댓글 수: 3
bym
2011년 9월 30일
as a tangent: in what situation would you use strncmp('asd', 'qwe', 0)?
Walter Roberson
2011년 9월 30일
longest prefix matching?
Jan
2011년 9월 30일
채택된 답변
추가 답변 (2개)
Kelly Kearney
2011년 10월 7일
2 개 추천
On the topic of history, I've requested this as an enhancement multiple times. When I wrote to the Mathworks to ask whether I could get a complete change history of a particular function (in my case, minor updates to datetick that hadn't made the release notes were affecting my code), I was told that the best way to check this was to look at the Revision line in the m-file itself.
Of course, this is only possible if you actually own all releases. I don't, but the Mathworks of does. Assuming they don't already have a centralized database of change histories for all functions, it seems to me it would be a relatively simple endeavor to write a simple file parser that reads out the revision line from each function in each release. Then users could get a clear idea of when each function was introduced, when others were phased out, and when both major and minor changes were made.
Walter Roberson
2011년 9월 29일
1 개 추천
I don't know when the functionality changed, but I observe that the documentation of strncmp and strncmpi were split as of 2011a. The merged 2010b page vs split 2011a page
The only "efficient" way I have found to identify changes is to request searching an older release, and then edit the URL to move between different versions. :(
댓글 수: 2
Walter Roberson
2011년 9월 29일
Darn. Beta version doesn't give any change history either, and also doesn't have that link near the top to the launchpad for searching specific releases.
Walter Roberson
2011년 9월 29일
http://www.mathworks.com/help/matlab/ref/strncmp.html
is the beta page.
카테고리
도움말 센터 및 File Exchange에서 System Commands에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!