Stuart’s MATLAB Videos

Watch and Learn

Trying Out inputparser

I’m going to try to use inputparser for the first time, to specify name-value pair parameters for my function.

Its been around for several years but I haven’t used it. Typically my functions are “old school” where parameters need to be in certain positions. I use varargin for optional additional parameters, followed by some logic to set default values should later parameters not be present.

Currently I have a function which already has a few parameters, and I want to add more. With positional parameters, you have to supply all the ones up to the one you need which can get cumbersome if there are many. So I thought I would try using inputparser and make some of the parameters name-value pairs. This will give more flexibility in allowing only certain parameters to be specified.

Features covered in this code-along style video include:

Play the video in full screen mode for a better viewing experience. 

  • print
  • send email


댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.