Error: Function definitions are not permitted at the prompt or in scripts.

Hi, can someone tell me what to do to solve the error prompt 'Function definitions are not permitted at the prompt or scripts'

 採用された回答

Matt Fig
Matt Fig 2012 年 10 月 4 日

1 投票

Don't try to define a function at the prompt or in a script. Put functions in their own M-files.

4 件のコメント

Habib Bipembi
Habib Bipembi 2012 年 10 月 4 日
I accepted the answer but I don't know how to do what you asked me to do
Matt Fig
Matt Fig 2012 年 10 月 4 日
You should probably read the help for functions:
help function
Walter Roberson
Walter Roberson 2012 年 10 月 4 日
Instead of entering (or copying and pasting) the code at the MATLAB command prompt, use an convenient editor (such as the built-in MATLAB editor), put the code into a file, and save the file with the same name as the function.
Habib Bipembi
Habib Bipembi 2012 年 10 月 6 日
I accepted the comment

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by