create static method in app designer

Hi all,
How do I create static methods in the App Designer? The dropdown menu only allows me to create either public or private functions.
I couldn't find any explicit documentation about this.

 採用された回答

Cris LaPierre
Cris LaPierre 2022 年 6 月 29 日

2 投票

I'm assuming you want a static method so that the first input does not have to be an object of the class. The way I could do this was to manually create a 'methods (Static)' section below my app properties. This is the same place a custom function (public or private) would appear. For example
properties (Access = private)
x
end
methods (Static)
function out = myFxn(in)
out = 2*in;
end
end

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品

リリース

R2019b

質問済み:

2022 年 6 月 29 日

回答済み:

2022 年 6 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by