gunits

版本 1.0.0.0 (2.3 KB) 作者: Sean de
Function that converts units using Google
393.0 次下载
更新时间 2010/9/1

查看许可证

help gunits

%Function to convert units using Google
%SCd 09/01/2010
%
%gunits searches using the Google convention e.g: '3ft to in'
%
%Input Arguments:
% -before: string with number and unit such as:
% '3ft', '17c','17lbf/in^2', '3 ft*lbf'
% -after: unit you wish to convert such as: (respectively)
% 'mm', 'f', 'N/ft^2','Newton*m'
%
% NOTE1: Google can be picky with the input. It's recommended
% to spell everything out and fill in multiplication/division/powers
% if you're having issues. Example:
%
% >>gunits('3psi','psf')
% ans = '<i>3 psi</i>' %if outNum was called; an error would've been produced
%
% >>gunits('3lbf/in^2','lbf/ft^2')
% ans = 3 (lbf / (in^2)) = 432 lbf / (ft^2)
%
% NOTE2: The units should be distinguishable with spaces removed e.g:
% 'lbf ft' becomes 'lbfft' which is not a unit. To fix use 'lbf*ft'
%
%Output Arguments:
% -outStr: string with the conversion
% -outNum: numeric value of answer (only if asked for)
%
%NOTE/DISCLAIMER:
% The algorithm used for retrieving the string is based solely on Google's
% web format. As (unfortunately!), I do not own or control Google, their
% format is subject to change, which could nullify the results of this program.
% Please let me know if this happens.
%

引用格式

Sean de (2024). gunits (https://www.mathworks.com/matlabcentral/fileexchange/28613-gunits), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2009b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Google 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0