How can I prompt user to press some key on keyboard let us say 'c' in order to continue the program

조회 수: 143 (최근 30일)
clc
clear all
fprintf('Following assumptions are assumed duing execution of program \n1. Fixed cost in establishing the warehouse is constant for all the warehouses. \n2. cost of production is also same for all manufacturing plants./n')
%%BEFORE THE MATLAB ASKS FOR AN INPUT FOR VARIABLE 'M' I WISH TO ASK IT TO PRESS A KEY IN ORDER TO CONTINUE
M = input('Number of Manufacturing plants: ');

채택된 답변

Harry
Harry 2014년 11월 1일
편집: Harry 2014년 11월 1일
Try this:
clear all; clc;
disp('The following assumptions are assumed during execution of the program:');
disp('1. The fixed cost in establishing the warehouse is constant for all warehouses.');
disp('2. The cost of production is also the same for all manufacturing plants.');
input('Press ''Enter'' to continue...','s');
M = input('Number of Manufacturing plants: ');

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 11월 1일
편집: Image Analyst 2014년 11월 1일
%some code
pause; % Wait for user to type any key
% code resumes.
Or for a GUI way:
%some code
msgbox('Click OK to continue'); % Wit for user to click OK button.
% code resumes.

카테고리

Help CenterFile Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by