Fileparts error
古いコメントを表示
If I run on Matlab 2011b, there is an error like that Error using fileparts Too many output arguments.
Is there alternative way to solve the problem?
2 件のコメント
Walter Roberson
2012 年 1 月 3 日
Could you post an example?
Could you post the traceback? I'm thinking there is a chance that one of your own functions might be overriding something that fileparts uses.
Jaejin Hwang
2012 年 1 月 4 日
採用された回答
その他の回答 (1 件)
Iain Robinson
2012 年 7 月 18 日
Jaejin, the error is caused because the syntax for the fileparts function has changed between versions of MATLAB.
In MATLAB 2009b (and earlier versions?), the old syntax was:
[pathstr, name, ext, versn] = fileparts(filename)
From MATLAB 2011a onwards the new syntax is:
[pathstr, name, ext] = fileparts(filename)
Using the old syntax in MATLAB 2011a or MATLAB 2011b will generate a warning.
Using the old syntax in MATLAB 2012a will generate an error.
I haven't tested this, but I think if you use the new syntax in any version from MATLAB 2009b onwards it will still work. This is because MATLAB will ignore function outputs that aren't assigned to a variable. By the way, be careful if you are using ~ notation (the tilde) to ignore output arguments. This feature was introduced in MATLAB 2009b, so will break compatibility with earlier versions.
カテゴリ
ヘルプ センター および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!