⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 num2mass.m

📁 航天工程工具箱
💻 M
字号:
function str=num2mass(m,tab)
%NUM2MASS  Displays mass in SI-units.
%   STR = NUM2MASS(M,TAB) returns a string containing
%   the value of the mass M (in kg) normalized in a proper power
%   of grams, kilograms or tons. Argument TAB can be entered
%   in order to align the prefix character on a distance of
%   at least TAB number of spaces from the last character in
%   the normalized value.
%   Ex:
%
%     num2mass(.21)   gives: '210 g'
%     num2mass(.21,4) gives: '210 g'
%     num2mass(.21,5) gives: '210  g'
%     num2mass(12)    gives: '12 kg'
%     num2mass(.0003) gives: '300 mg'
%     num2mass(25054) gives: '25.054 ton'
%
%   See also NUM2STR, SEC2HMS.

% Copyright (c) 2002-02-09, B. Rasmus Anthin.
if ~isnan(m) & m   e=floor(log10(abs(m*(1+5*3*eps))));   e=e-mod(e,3);else   e=0;endif e<3   [s,p]=num2sci(m*1000);   if nargin==2      str=[s blanks(tab-length(s)-1) ' ' p 'g'];   else      str=[s ' ' p 'g'];   endelse   [s,p]=num2sci(m/1000);   if nargin==2      str=[s blanks(tab-length(s)-1) ' ' p 'ton'];   else      str=[s ' ' p 'ton'];   endend

⌨️ 快捷键说明

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