Use packages to group the methods of the class

4 ビュー (過去 30 日間)
Andrea Stevanato
Andrea Stevanato 2018 年 5 月 23 日
コメント済み: Adam 2018 年 5 月 24 日
It's possible to group the methods of the classe like this:
@Myclass
Myclass.m
+pkg1
method11.m
+pkg2
method12.m
method22.m
othermethod.m
and use it with obj.pkg2.method12

採用された回答

Robert U
Robert U 2018 年 5 月 24 日
Hi Andrea Stevanato,
according to Matlab documentation there is no packaging of methods introduced:
You may have a "private" folder containing methods with private access. All other methods have to be in class folder.
Found also here:
Kind regards,
Robert
  3 件のコメント
Robert U
Robert U 2018 年 5 月 24 日
If you want to cluster your methods according to purpose, you could go for the function name: obj.utility_method1(), obj.utility_method2()...
Kind regards,
Robert
Adam
Adam 2018 年 5 月 24 日
It sounds like they should be in separate classes if you have a need to call them in that way, although I can't think off hand of anything which specifically drives the need for how a function ought to be called, without an example.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by