Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

??? input argument "n" is not defined

Status
Not open for further replies.

zbik

Automotive
Joined
Aug 3, 2006
Messages
1
Location
PL
Dear Friends
I have written Function f(n) in Matlab m-file and when I am trying to call f(n) (earlier writng n=1) Matlab tells me: "???input argument "n" is not defined"
Could any body help me?
best regards
zbik

My function looks like this
function g=f(n)
g=n+1

 
1 – for troubleshooting, type n before you execute the function. See if Matlab comes back with 1 to doublecheck whether Matlab is seeing the correct value of n.

2 – I’m not sure if it makes a difference to y our question, but I thought an end statement is required at the end of a function.


=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Also I would try typing n=1 directly before the function and see if it works. If it works there but doesn’t work within your program, then maybe you have a problem with variable scoping. The variable n may have been defined in some function but is not available in the module that you are in now. Look at the global statement and related matlab documention.

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top