|
这道题我提交的答案是- function bmi = bmi_calculator(hw)
- % Convert the height values from inches to meters
- h=hw(:,1)*0.0254;
- % Convert the weight values from lbs to kilograms
- w=hw(:,2)/2.2;
- bmi=zeros([1 size(hw,1)]);
- for i=1:size(hw,1)
- bmi(i) = w(i)/h(i)^2;
- end
- end
复制代码 它通过了Test 2,但是Test 1报错,如下
Error using assert The condition input argument must be convertible to a scalar logical. Error in Test1 (line 4) assert(all(abs(bmi_calculator(hw) - bmi_correct) < 1e-4))
这是为什么呢 |
|