Inquiry about the use of functions and vectors

1 回表示 (過去 30 日間)
Abdulshakur Nyange
Abdulshakur Nyange 2019 年 1 月 27 日
コメント済み: Abdulshakur Nyange 2019 年 1 月 28 日
I am trying to nest a function but I am trying to make it static so that it can be accessed by the main function. I was wondering if there even is such a thing as a static function and if my approach. I am also trying to create a plot based on multiple values from a vector simultaneously. Let me know if I am applying the correct approach. The error I get when trying to run is shown below:

回答 (1 件)

Steven Lord
Steven Lord 2019 年 1 月 28 日
The Static method attribute only applies to methods of classes, not to local functions inside a script or function file. If you want GenerateSignal to be a local function defined inside DTMFGenerate.m that can be called by the main function in that file, DTMFGenerate, or by other local functions in the file then just define it using the function keyword.
In the mystats.m example on this documentation page, the functions mymean and mymedian are local to the file and the main function mystats can call them but they cannot be called directly by code outside that file.
  1 件のコメント
Abdulshakur Nyange
Abdulshakur Nyange 2019 年 1 月 28 日
Thank you for the help I appreciate it

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by