Date: Dec 6, 2012 11:36 AM Author: Sargondjani Subject: Re: I'm new to matlab; why is this function wrong? you can only define functions inside a function-file and not in a script (dont ask me why, because it bothered me too, but matlab developers usually have good reasons for doing such things)
1) transform your script into a function:
start with: "function my_script()" and end with "end"
2) define the function in an m-file that you call in your script
i hope this helps...