How can I write this function so I can use it on multiple values?
조회 수: 1 (최근 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!