Add class to Scripts
42 ビュー (過去 30 日間)
古いコメントを表示
Since R2016B it is possible to create a local function inside a script, reducing the burden of many m files. This is described here: https://nl.mathworks.com/help/matlab/matlab_prog/local-functions-in-scripts.html
How can the same be done with classes? I want to overload a method of an existing class, and plan to use it only in a certain script.
When I try this, matlab R2018b complains about: Illegal use of reserved keyword "classdef".
0 件のコメント
回答 (1 件)
Walter Roberson
2020 年 6 月 3 日
That cannot be done. Class methods can only be defined inside of .m files whose first executable word is classdef
2 件のコメント
Walter Roberson
2020 年 6 月 3 日
I have not been told whether there are plans for this. I would not expect it to happen.
参考
カテゴリ
Help Center および File Exchange で Software Development Tools についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!