migrate from R14 to newwer matlab

3 ビュー (過去 30 日間)
michael
michael 2020 年 3 月 14 日
コメント済み: Walter Roberson 2020 年 3 月 14 日
Hello all,
As one who is still using Matlab R14, I'd like to migrate to newwer matlab versions.
As I've seen, there is preaty big difference in terms of the scripts/function usage which now are more similar to the C++ / Java style.
Is there any guide for for this transition from R14 ?
  1 件のコメント
dpb
dpb 2020 年 3 月 14 日
Direct jump, don't think so; it was a transition from release to release with the big jump to HG2 @ R2014b iirc.
It's all going to depend on just what your existing code that you need to migrate actually does and which features/toolboxes it used as to how much is/isn't going to be compatible.
All the new features are of no never mind for old code, as Walter says it's what's been removed or fundamentally changed in the base features that's going to be the issue.
There's a whole list with every release of what are behavior changes between releases for some of the common functions, even; just 'cuz a given function runs doesn't mean, it may not have a different output. :(

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 3 月 14 日
The changes that are not backwards compatible that I can think of are:
  • if you are in a function and you call a script and the script assigns to variables that did not exist before, then there are circumstances in which modern versions can more or less ignore the new variables inside the function. In particular, if you are inside a function (say FUN) and happen to assign to a variable (say F) inside a script (say S.m) to a variable that has the same name as any function (say function F) on the path, then when you attempt to use the variable inside the function (FUN), MATLAB will find the function F (that it already knew about before the script ran) rather than the variable F (that was created inside the script.) The way to get around this is to assign [anything!] to the variable (F) before calling the script, so that MATLAB can plainly see that it is a variable instead of a function.
  • there are differences in exactly how variables mentioned in anonymous functions are found in the case that at least one of the variables did not exist at the time the anonymous function was created. This is so rare that I did not even know that it was possible to do until I saw the release notes that said it was changed
  • In the case of callbacks that are specified as quoted strings, in old old versions if a function name was mentioned that was defined inside the same file as the callback was created in, then MATLAB would be able to find the function. At some point not long after R14, this was changed so that functions mentioned inside callbacks must resolve to something visible to the base workspace, such as functions defined as the first function inside a .m file, or class methods. In particular, callbacks created by old old versions of GUIDE may need to be updated.
  • There are some differences in exactly how MATLAB searches for variables inside nested functions (R14 introduced nested functions.)
It is plausible that there were some changes in defining old-style classes that might cause problems. The new style of classes with classdef is recommended, but the old style is still permitted.
MATLAB added some new facilities since R14, but most code that did not count on "poofing variables into existence" inside scripts or finding local functions mentioned in strings should still work.
Much more of an issue for MATLAB is that some functions, especially toolbox functions, may have changed or vanished. For example the functions for reading video files from R14 are gone, replaced with new functions with different names.
  1 件のコメント
Walter Roberson
Walter Roberson 2020 年 3 月 14 日
dpb's comments remind me that there is another incompatibility:
Handles to graphics objects used to be stored as double precision numbers, but are not anymore. There is more backwards compatibility with storing them as numbers than most people realize, but there are still some operations that do not work because of the change. In particular, attempting to mix numbers and handles in a vector might fail:
abc = [gca(); pi] %fails
def = gca(); def(2) = pi; %fails
ghi(2) = pi; ghi(1) = gca(); %works
Also, in the past it used to be possible to abbreviate the figure property named NumberTitle to Number but since R2014b, Number is now a property with its own meaning and you have to spell out NumberTitle.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by