I'm making a interactive clock , and one of the features that the clock have is a "reminder". I'd like to know if there is a way to ask the user at what time would he like to receive the pop-up message and if i could put it in a while . I'm imagining something like give a variable to the time inputed to the user, and then use a while cycle, so when the variable turns false ( a.k.a the time that the user inputed is the time "now" ) the reminder would pop up. Can someone help?
MATLAB: Is there a way to ask the user the hours
clockpop-upreminderwhile
Related Solutions
Try this to ask your user for an integer value for the threshold:
% Ask user for one integer number.
defaultValue = 45;titleBar = 'Enter an integer value';userPrompt = 'Enter the threshold';caUserInput = inputdlg(userPrompt, titleBar, 1, {num2str(defaultValue)});if isempty(caUserInput),return,end; % Bail out if they clicked Cancel.
% Round to nearest integer in case they entered a floating point number.
integerValue = round(str2double(cell2mat(caUserInput)));% Check for a valid integer.
if isnan(integerValue) % They didn't enter a number.
% They clicked Cancel, or entered a character, symbols, or something else not allowed.
integerValue = defaultValue; message = sprintf('I said it had to be an integer.\nTry replacing the user.\nI will use %d and continue.', integerValue); uiwait(warndlg(message));end
Here are my number input snippets. Feel free to modify/adapt:
% Ask user for one integer number.
defaultValue = 45;titleBar = 'Enter a value';userPrompt = 'Enter the integer';caUserInput = inputdlg(userPrompt, titleBar, 1, {num2str(defaultValue)});if isempty(caUserInput),return,end; % Bail out if they clicked Cancel.
% Round to nearest integer in case they entered a floating point number.
integerValue = round(str2double(cell2mat(caUserInput)));% Check for a valid integer.
if isnan(integerValue) % They didn't enter a number.
% They clicked Cancel, or entered a character, symbols, or something else not allowed.
integerValue = defaultValue; message = sprintf('I said it had to be an integer.\nI will use %d and continue.', integerValue); uiwait(warndlg(message));end% Ask user for two floating point numbers.
defaultValue = {'45.67', '78.91'};titleBar = 'Enter a value';userPrompt = {'Enter floating point number 1 : ', 'Enter floating point number 2: '};caUserInput = inputdlg(userPrompt, titleBar, 1, defaultValue);if isempty(caUserInput),return,end; % Bail out if they clicked Cancel.% Convert to floating point from string.
usersValue1 = str2double(caUserInput{1})usersValue2 = str2double(caUserInput{2})% Check for a valid number.
if isnan(usersValue1) % They didn't enter a number. % They clicked Cancel, or entered a character, symbols, or something else not allowed. % Convert the default from a string and stick that into usersValue1.
usersValue1 = str2double(defaultValue{1}); message = sprintf('I said it had to be a number.\nI will use %.2f and continue.', usersValue1); uiwait(warndlg(message));end
Best Answer