printPhoto('myfile.jpg')
File name: myfile.jpg
Finish: glossy
Using defaults:
'finish' 'color' 'width' 'height'
printPhoto(100)
Error using printPhoto (line 23)
The value of 'filename' is invalid. It must satisfy the function: ischar.
printPhoto('myfile.jpg','satin')
Error using printPhoto (line 23)
The value of 'finish' is invalid. Expected input to match one of these strings:
'glossy', 'matte'
The input, 'satin', did not match any of the valid strings.
printPhoto('myfile.jpg','height',10,'width',8)
File name: myfile.jpg
Finish: glossy
Using defaults:
'finish' 'color'
To pass a value for the nth positional input, either specify values for the previous (n – 1)
inputs or pass the input as a parameter name and value pair. For example, these function
calls assign the same values to finish (default 'glossy') and color:
printPhoto('myfile.gif','glossy','CMYK') % positional
printPhoto('myfile.gif','color','CMYK') % name and value
See Also
inputParser | varargin
More About
- “Input Parser Validation Functions” on page 21-21
21 Function Arguments