Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

function

0 views
Skip to first unread message

K

unread,
Mar 11, 2010, 7:35:21 PM3/11/10
to
Hi, I recently downloaded Matlab and have the following problem

If I code a simple code on function, e.g. "function y=poly(x,a)"

Matlab gives me an error message

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

Can anyone please let me know as to what is happening?? Any help is deeply appreciated.

Thanks

Sadik

unread,
Mar 11, 2010, 7:46:04 PM3/11/10
to
Hi,

You should start an m file [that is, a file with extension .m] with the keyword function, then you should have no problems at all.

The reason you are getting this error could be because:

1) You are typing this in the command window.
To avoid this, please type

edit newFunction

or some other name. This will open the Editor, where you will see a blank page to write whatever code you would like.

2) You have already opened the editor but after writing a few lines of code, you are typing the keyword function.

Hope this helps,

Best.


"K " <kbh...@gmail.com> wrote in message <hnc289$slr$1...@fred.mathworks.com>...

0 new messages