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'

 采纳的回答

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

4 个评论

I accepted the answer but I don't know how to do what you asked me to do
You should probably read the help for functions:
help function
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.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by