Create a local function to continually prompt the user as long as the response is empty. The "inputWrapper" function will be added to the bottom of your function/script and you'll need to replace all of the input() commands with the inputWrapper() function using the same inputs you would use with input().
The only way to escape is to enter a non-empty response or by pressing ctrl+c.
out = inputWrapper('Enter something: ');
function t = inputWrapper(varargin)
fprintf('You must enter a response.\n')
Note that the input method of acquiring data from the user is highly unconstrained and should be used with input validation to ensure the user entered appropriate responses (see this answer for details).
0 Comments
Sign in to comment.