Here's an example...
function fruitsandveggies(varargin)
validinputs = {'tomatoes', 'carrots', 'lettuce', 'blueberries', 'strawberries'};
mask = ismember(lower(varargin),lower(validinputs));
if ~all(mask)
error('Valid inputs are: %s',sprintf('%s ',validinputs{:}));
end
% insert additional code here
end
In this case, if the user enters one or more invalid inputs, the function gives an error.
fruitsandveggies('carrots') %works
fruitsandveggies('Strawberries','TOMATOES') %works
fruitsandveggies('carrots','lettuce','peas') %gives an error!
Is this what you were looking for?