matlab求大神想写一个把厘米转换为feet和inch的程序function[Feet,Inch]=CMtoFeetI

问题描述:

matlab求大神
想写一个把厘米转换为feet和inch的程序
function[Feet,Inch]=CMtoFeetInch(height)
height=input('');
Feet=floor(height/(229*12/90));
Inch=round(height-(12*Feet*229/90));
end
然后自己写了个这个,结果只输出了feet.
1个回答 分类:综合 2014-10-04

问题解答:

我来补答
function [Feet,Inch] = CMtoFeetInch(height)
Feet = floor(height/(229*12/90));
Inch = round(height-(12*Feet*229/90));
% 调用
>>[ft,ic] = CMtoFeetInch(100)
ft =
3
ic =
8
% 如果不给返回变量只会返回第一个结果
>> CMtoFeetInch(100)
ans =
3
 
 
展开全文阅读
剩余:2000