📄 asknumber.m
字号:
function Num=asknumber(num, nmin, nmax, tit)%ASKNUMBER Ask to input a number in the rigth corner of the figure.%% NUM=ASKNUMBER(NUM, MIN, MAX, TITLE)%% NUM is the original number, default is 0.% MIN is the minimal value that the number can have.% MAX is the maximal value that the number can have.% TITLE a string.% % Return the number only when ENTER key is pressed.%% Claudio May 14, 1995%%% Copyright (c) 1995 by Claudio Rivetti and Mark Young% claudio@alice.uoregon.edu, mark@alice.uoregon.edu%global Uibgcolor Handlefig frame uitit uied nmin nmaxif nargin > 4 error('Too many input arguments.');endif nargin < 4 tit='';endif nargin < 3 nmax=inf;endif nargin < 2 nmin=-inf;end if nargin < 1 num=0;end fpos = [0.8026, 0.9250, 0.1974, 0.070];titpos= [0.8076, 0.9670, 0.1874, 0.025];edpos = [0.85, 0.936, 0.1, 0.03];frame = uicontrol(Handlefig, 'Style', 'frame',... 'Units', 'Normalized',... 'Position', fpos,... 'BackgroundColor', Uibgcolor);uitit = uicontrol(Handlefig, 'Style', 'text',... 'String', tit,... 'Units', 'normalized',... 'Position', [fpos(1)+0.005 fpos(2)+fpos(4)-0.028, fpos(3)-0.01, 0.025],... 'HorizontalAlignment', 'center',... 'BackgroundColor', Uibgcolor);uied=uicontrol(Handlefig, 'Style', 'edit',... 'String', num2str(num),... 'Units', 'normalized',... 'position', edpos,... 'Value', num,... 'UserData', 0,... 'HorizontalAlignment', 'center');while 1 if waitforbuttonpress == 1 k=get(gcf, 'CurrentCharacter'); if abs(k) == 13 break; end endendeditstr2value(uied,nmin,nmax);Num=get(uied, 'value');delete(frame, uitit, uied);return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -