roundoff.m

来自「计量工具箱」· M 代码 · 共 19 行

M
19
字号
function y = roundoff(number,decimal_places)% PURPOSE: Rounds a number(vector) to a specified number of decimal places% ----------------------------------------------------% USAGE: y = roundoff(x,dplaces)%        where: x       = a vector (or scalar)%               dplaces = # of decimal places in y% ----------------------------------------------------% RETURNS: y = a vector (or scalar) with the%          specified decimal places% ----------------------------------------------------% I don't know who wrote this one, but it comes% in handy sometimes  decimals = 10.^decimal_places;  y = fix(decimals * number + 0.5)./decimals;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?