From: sargam on
"Ashwini Deshpande" <vd.ashwini(a)mathworks.com> wrote in message <foe1td$63l$1(a)fred.mathworks.com>...
> "bhargavi srinivasan" <bhargavi.nospam(a)mathworks.com> wrote
> in message <foe0ar$cio$1(a)fred.mathworks.com>...
> > when i try to call a function from main program,i counter
> > tis error
> > ??? function
> > |
> > Error: Function definitions are not permitted at the
> > prompt or in scripts.
> >
> > wat does it imply ...how to overcome it..can anyone help?
>
> Hi Bhargavi,
>
> You must have not defined your main program as function.
> When you call a function from script file you will get that
> error.
> Define your main program as function and then call the other
> function in its body .. or else the function which you are
> calling has to be saved in different m-file and then can be
> called from script file. Try both and if you get any error
> let me know.
>
> Ashwini

Hello

I am getting the same error. I have 1 main file & from this i am calling some functions. These functions are defined in another mfile.. with this approch my code is working but I want only 1 single .m file & everything should be defined in this file rather then making another mfile for defining my function. when I write the function in the main file it gives me error
Function definitions are not permitted at the prompt or in scripts.