Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Write a function bmiCalc() that takes two inputs; a filename with personal data (char array), and the name of a person of interest (a
2. Write a function bmiCalc() that takes two inputs; a filename with personal data (char array), and the name of a person of interest (a string). The function will return the BMI of the person of interest. The data file is provided on Moodle. First read the data from the file using readcell() Use a for loop and a built in function (check reference sheet) to compare the name of the person of interest to the names provided in the data file and extract the mass and height of ONLY the person of interest. The height is the second column, the mass is the third. Be careful when using {} or () to index. There is a difference. Calculate BMI = mass (kg) / height(in)? Return the calculated BMI The function header and an example run are provided below. function [bmi] = bmicalc(filename, personName) Using the data provided in filename, returns the BMI of the user whose string name is the string personName Inputs: filename - character array of the personal data file personName - name of the person whose BMI is to be calculated Returns: bmi - bmi found by mass/ height^2 Command Window >> BMI_Jack = bmiCalc('BMI_Data.xlsx', "Jack") BMI_Jack = 20.518 fx >>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started