inp.m

版本 1.1.0.0 (2.3 KB) 作者: Miroslav Balda
The function inp.m serves for keyboard input supported by default value
5.6K 次下载
更新时间 2009/1/12

查看许可证

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

引用格式

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

MATLAB 版本兼容性
创建方式 R2006b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Desktop 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.1.0.0

Implemented better displaying of comples numbers. Improved description.

1.0.0.0

Improving description