The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: I'm new to matlab; why is this function wrong?
Replies: 5   Last Post: Dec 6, 2012 12:41 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 176
Registered: 8/30/11
Re: I'm new to matlab; why is this function wrong?
Posted: Dec 6, 2012 11:36 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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)

so either:
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...

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.