I have a Matlab function
that has numerous name-value parameter inputs. For some of the parameter names, there are a lot of possible values (which are not always obvious) that the user can choose from. What I would like to do is, IF the user calls the name, but does NOT give a value, THEN Matlab would display possible entries AND THEN take the user's input.
For example I have a function such as:
function getSomeData( varargin )
p=inputParser;
defaultData='abc';
addParameter(p, 'Data', defaultData);
parse(p,varargin{:});
end
If the user were to call the function in the command window such as:
>> getSomeData('Data')
in which the user did not give a value for 'Data'
, the window would display and prompt
>> getSomeData('Data')
No value for 'Data' Given
Possible Values of 'Data' are:
'abc'
'def'
'other'
Please input your 'Data':
in which I could use the result=input(prompt)
function.
Any help or advice is very much appreciated! Cheers