How can I write this function so I can use it on multiple values?
4 次查看(过去 30 天)
显示 更早的评论
I have written a function for finding the body mass index based on weight and height. However, I can only calculate this for one person at a time. If I am given three weights and corresponding heights, how can I calculate these all at once?
Here is the scalar code I have so far:
function [ bmi ] = calculatebmi( h,w )
%UNTITLED9 Summary of this function goes here
% Detailed explanation goes here
bmi=(w*4.88)/h.^2
end
0 个评论
采纳的回答
Mischa Kim
2014-10-4
编辑:Mischa Kim
2014-10-4
Use
bmi = (w*4.88)./h.^2
instead. Note the dot in front of the forward slash.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!