hi everyone i just want to know how to take input from the user that which frame user wants to process from a certain video
Info
This question is closed. Reopen it to edit or answer.
Show older comments
i will post the code if someone is not able to understand my question
Answers (2)
Geoff Hayes
on 1 Nov 2015
0 votes
Image Analyst
on 1 Nov 2015
Try this robust snippet that asks the user for an integer (which will be the frame number they want to process). It also handles the case where they don't do as they're told:
% Ask user for an integer number.
defaultValue = 45;
titleBar = 'Enter an integer 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
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!