Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query on nvp #7

Closed
dianixn opened this issue Apr 23, 2021 · 2 comments
Closed

Query on nvp #7

dianixn opened this issue Apr 23, 2021 · 2 comments

Comments

@dianixn
Copy link

dianixn commented Apr 23, 2021

Hi, I am confused about what is nvp of all the files, it seems like a input but I did not find the defination of that, or what is that? Can you give me a hint on that and how to define nvp, is that a method of something? It may be a stupid question :) I am a beginner

@bwdGitHub
Copy link
Collaborator

Hi - I think you're referring to the function argument syntax documented here, the documentation uses options but I've typically used nvp. The nvp input is an optional input and is used to define the optional name-value pairs of the function. The short version is:

function foo(x,nvp)
arguments
x
nvp.Bar= 0
end
...

gives the function foo an optional Name-Value pair input with name "Bar" and default value 0, so you can make calls like foo(1,"Bar",2);.

Documentation of the name-value pairs should exist in the m-help of the file.

@dianixn
Copy link
Author

dianixn commented Apr 23, 2021

Ohhh I got it, thanks so much!

@dianixn dianixn closed this as completed Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants