This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
I'm trying to use the new arguments
block instead of inputparser
for all of my Name/Value pairs in MATLAB now, and overall, it's working much better. However, there is one thing I could do with inputparser
that I don't seem to be able to do with the argument block, but perhaps there's a way?
I want to write a function that has name/value pairs and an optional input. Using inputparser
I was able to check the first element of varargin
to see if it was a string (indicating the beginning of a Name/Value pair) or if it was something else (indicating it was my optional input). I'm not sure how to replicate this functionality using the argument
block.
To give you an example of what I mean, using a MATLAB built in. I want to do something like how the plot
command works, how you can write both
plot(Y, 'LineWidth', 2)
and
plot(X,Y, 'LineWidth', 2)
Subreddit
Post Details
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/matlab/comm...