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

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.
I accepted the comment

댓글을 달려면 로그인하십시오.

추가 답변 (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