Create a vector of structures experiments that stores information on subjects us
ID: 3653382 • Letter: C
Question
Create a vector of structures experiments that stores information on subjects used in an experiment. Each struct has four fields: num, name, weights, and height. The field num is an integer, name is a string, weights is a vector with two values (both of which are double values), and height is a struct with fields feet and inches (both of which are integers). Then, Write a function printhts that will receive a vector in this format and will print the height of each subject in inches. This function calls another function howhigh that receives a height struct and returns the total height in inches. This function could also be called separately. Here is an example of calling the printhts function (assuming the preceding data), which calls the howhigh function:Explanation / Answer
%See your other question %_____________________________________________________ %printhts.m function printhts(experiments) howhigh(experiments.height); %_____________________________________________________ %howhigh.m function howhigh(height) feetInInch=12 *double(height.feet); totInch=double(height.inches) + feetInInch; str=sprintf('%s %d','Total inches: ',totInch); disp(str);
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.