inp.m

The function inp.m serves for keyboard input supported by default value
5,6K download
Aggiornato 12 gen 2009

Visualizza la licenza

The function implements keyboard input supported by a default value. A user may either accept the default value or enter a new one. Controlled input of data from the keyboard is advantageous for debugging, making protocols via function diary, parametric studies when changing parameters depending on a result of the current iteration, branching run of a program under user wishes, etc, all without debugging.

Forms of a call:
~~~~~~~~~~~~~~~~
inp % display help
data = inp; % similar to input('input')
data = inp(prompt); % similar to input(prompt)
data = inp(prompt,deflt);
data = inp(prompt,deflt,form);
data = inp(prompt,deflt,form,nsp);
% prompt = string of characters
% input with a default value of input data
% form = format of the screen output; default '%9.4f'; format is persistent until new value is given
% nsp = number of leading spaces before prompt on screen; nsp = 10 is persistent until a new value is given
% data = either deflt value if accepted by ENTER, or a new input value

Examples:
~~~~~~~~~
p = inp('pressure [MPa]',7.5); % if no new value is given, p=7.5
if strcmp(inp('Continue','yes'),'yes') % for user's on-line decission
% True branch
else
% False branch
end
A = eval(inp('A','[B,x]')); % A = [B,x] if no new input
cx = inp('cxconst',1+i*pi); % gives cx = 1+3.14159i, if accepted

Cita come

Miroslav Balda (2024). inp.m (https://www.mathworks.com/matlabcentral/fileexchange/9033-inp-m), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2006b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Desktop in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
1.1.0.0

Implemented better displaying of comples numbers. Improved description.

1.0.0.0

Improving description