Q7 MATLAB help Create a text file (.txt) containing the name, weight (pounds), and height (inches) of five individuals as shown below. John Elliot 175 67 Monica Lopez 158 65 David Miller 215 71 Janet Anderson 185 72 Jessica Diaz 135 61 Then write a script to read the content of the file using fgetl function and calculate the body mass index (BMI=703*weight/Height2 ) of each individual. The script should print a short 2 sentence showing the name and body mass index of each individual on separate lines in the Command Window. Also make sure to error check opening and closing of the text file.
fileName=input('Enter name of the file: ','s');
f=fopen(fileName,'r');
if f==-1
error('File could not be opened!!!')
else
line=fgetl(f);
while line~=-1
data=split(line);
fname=data{1};
lname=data{2};
weight=str2double(data{3});
height=str2double(data{4});
BMI=703*weight/(height*height);
fprintf('Name: %s
%s\nBMI: %.2f\n',fname,lname,BMI)
line=fgetl(f);
end
end
f2=fclose(f);
if f2==-1
error('File could not be closed!!!')
end
Q7 MATLAB help Create a text file (.txt) containing the name, weight (pounds), and height (inches)...
+ Run C Code IMPORTANT: • Run the following code cell to create the input file, biostats.csv, which you will be using later. 74, In [ ]: N %%file biostats.csv Name, Sex, Age, Alex, M, 41, Bert, M, 42, Dave, M, 39, Elly, F, 30, Fran, F, 33, Jake, M, F, Luke, M, 34, F Myra, M, M, 38, Ruth, F, 28, 22 22 323 47 47, Height, Weight 170 200 167 70 115 143 139 280 98 75, 350...
C++ Create an application that searches a file of male and female first names. A link to the file is provided on the class webpage. "FirstNames2015.txt" is a list of the most popular baby names in the United States and was provided by the Social Security Administration. Each line in the file contains a boy's name and a girl's name. The file is space-delimited, meaning that the space character is used to separate the boy name from the girl name....