numeric UI Control

Version 1.5.0.0 (11,1 KB) von Kyle
Make a custom ui control that is an editbox that only allows numeric inputs.
400 Downloads
Aktualisiert 28. Feb 2012

Lizenz anzeigen

Allow a uicontrol that is an edit box that only allows numeric inputs. There are different types of inputs (ie integers, non-negative, scalars). The top level command is numericEdit. There are also sub files that are helpful like customControl that can be used independently.

Requires matlab version that can utilize classdef.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% numericEdit
%
% h = numericEdit(numericType, AllowDecimal, AllowNegative, 'parameter,
% 'value', ...)
%
% Creates a uicontrol edit box that must be numeric.
% NOTE: fixing non numeric inputs relies on a timer object and is thus
% not incredibly reliable.
%
% Types of numeric are accessed by numericEdit. (various types)
% ONLY_NUMERIC_CHARACTERS:
% literally only characters "-", and 0-9. are allowed
% ONLY_NUMERIC_RESULT:
% the result will be checked after enter is finished and attempt to
% convert input into a numeric, ie pi will result in 3.14159 even
% though pi explicity is not 0-9.
% ONLY_LENGTH_ONE_NUMERIC_RESULT:
% Check the result and must be numeric with length=1
%
% AllowDecimal is a boolean to allow not integer data
% AllowNegative is a boolean to allow negative numbers
%
% Example
% numericEdit(numericEdit.ONLY_NUMERIC_CHARACTERS, true, true, 'width',10)
%
% See also customControl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Zitieren als

Kyle (2026). numeric UI Control (https://de.mathworks.com/matlabcentral/fileexchange/35095-numeric-ui-control), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2009a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Version Veröffentlicht Versionshinweise
1.5.0.0

updated tags

1.4.0.0

updated tags

1.3.0.0

missing enum file included in zip

1.0.0.0