Change of set function in the future

3 views (last 30 days)
I've read the release notes of Matlab 2012a and found this: ReleaseNotes: Change of set functions. This does not concern 2012a! Then the output of unique etc. will contain the index of the first occurence and the indices are column instead of row vectors.
Does this change affect your work? Will it be a benefit for you? How many lines of code do you have to check to see, if you old programs will be compatible with this midification of standard functions?

Accepted Answer

Penny Anderson
Penny Anderson on 2 Mar 2012
Hi Jan,
The good news is that you have quite some time - several releases - in which to evaluate the impact of this change on your large code base. It need not be as complicated as you outline above.
1. Simply add a trailing 'R2012a' flag to all occurrences of the set functions in you code and run your test suite. 2. Any tests that fail - go back and change the 'R2012a' flag to 'legacy'. Re-run and those tests should now pass.
We understand large MATLAB codes exercising some of our oldest and most powerful features exist, and make it difficult to change those functions, even if the change is really a bug fix. Our hope is that by offering this phased approach to evaluate and buy into the new behavior will give customers a comfortable window in which to adopt it.
Please be in touch if you have other comments. They are always welcome!
Penny Anderson MathWorks, Inc.
  3 Comments
Matt Fig
Matt Fig on 27 Aug 2012
How is this 'change' a 'bug fix'??
Mike Hosea
Mike Hosea on 28 Aug 2012
I am not aware of any significant bugs, but I am aware of several silly edge cases, such as union(zeros(0,1),zeros(0,1)) returning zeros(1,0). A collection of such bugs provided the impetus to examine the set functions thoroughly and holistically. The new versions enforce clear rules about output shapes, even in degenerate cases. Some useful functionality/flexibility was added in addition to fixing the bugs. Backward incompatibilities were a foregone conclusion with or without the added functionality, so once it was decided to have the 'R2012a' and 'legacy' flags to ameliorate that problem (with apologies to Jan, who understandably may not have felt adequately accommodated by it), I guess some liberty was taken to make the new default behavior what it arguably should have been all along vis-a-vis 'first' and 'last'.

Sign in to comment.

More Answers (1)

Jan
Jan on 2 Mar 2012
The new features of the set functions are powerful and useful. I can add a 'last' flag to all of the unique commands in my code, if the old ordering scheme is required. And I can reshape the output manually to have the former row shape.
The only problem I have is, that I'm supporting a Matlab program with some hundred thousands code lines and I have to check more than 1500 occurences of these commands in my code. Either I analyse the surrounding code to see, if it adjustments are required, or I add the 'last' flag and an extra-line for the reshaping in general. Both solutions consume a remarkable amount of time, and both will set the status of the source code to not tested.
Therefore this change will mean for me:
  • About 1500 minutes (25 hours) to check the code - one minute per occurence is a fair estimation, because some commands will use the first output only, while others will be more complicated.
  • About 30 hours to run the unit-tests for the tool functions, compare their log files and some automated integration tests for the main functions.
  • I have to create and deliver a new release, which is compatible with the new features. The documentation needs a small number of updates in consequence.
  • The labs, which use this software, have to run the updated version for about two weeks in parallel to the old version to compare the results.
I see a general conflict between using or publishing large Matlab programs and upgrading the Matlab release. Distributing compiled programs is not an option, because the software is used for scientific projects and the ability to see and modify the source is important. The avoidance of the updating is not a sufficient option also, because existing bugs are usually fixed in newer releases only - e.g. the problems of audioplayer in 2011b are solved by installing 2012a.
The common appearence of 1. changes in the basic functions and 2. the bugfix by upgrade strategy is a very strong drawback, when large Matlab programs are used in scientific projects. What a pitty.

Categories

Find more on Holidays / Seasons 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!