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

Answers (2)

Umair - how do you wish to ask the user which frame she or he wishes to process? You can make the request in the Command Window using input, or by creating an input dialog using inputdlg, or by creating a GUI.
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.

Asked:

on 1 Nov 2015

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!