How to have a class that contains multiple functions that is used in other classes?

6 ビュー (過去 30 日間)
Sean
Sean 2023 年 12 月 4 日
編集済み: Matt J 2023 年 12 月 5 日
I've been having a hard time trying to figure out how to have multiple functions in one class (a "Utility_Class") that can be used within other classes ("Tech1", "Tech2", & "Tech3").
I know I have to import, but what is the right approach on importanting and how do I call the method to be applied within the following classes: "Tech1", "Tech2", & "Tech3".
If I need to add more context, I'm willing to add more.
  1 件のコメント
Matt J
Matt J 2023 年 12 月 4 日
編集済み: Matt J 2023 年 12 月 4 日
Importing has nothing to do with accessing the methods of classes in Matlab. Perhaps you are thinking of packages, rather than classes?

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

採用された回答

Matt J
Matt J 2023 年 12 月 4 日
編集済み: Matt J 2023 年 12 月 5 日
A static class method can be imported from a package like in this example,
You can also import a static method that is not packaged,
import Utitlity_Class.methodname
but I think most people just call the static method using the fully qualified name Utitlity_Class.methodname().

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by