📄 isnearinteger.m
字号:
function bool=isnearinteger(x,tol)
% Function checks if x is approximately integer (with tolerance "tol")
%
% bool=isnearinteger(x,tol)
% INPUT
% x variable to check
% tol maximum deviation from integer;
% default 0
% OUTPUT
% bool logical variable (1 if abs(x-round(x)) <= tol,
% 0 otherwise)
if nargin == 1
bool=mod(x,1) == 0;
else
bool=abs(x-round(x)) <= tol;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -