Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help!!! Create a vector of structures \'experiments\' that stores informa

ID: 3553607 • Letter: P

Question

Please help!!!


Create a vector of structures 'experiments' that stores information on subjects used in experiment. Each stock has four fields: num, name, weights, and height. The num field is an integer, name is a string, weights is a vector with two values (both of which are double values), and height is a struck with the fields feet and inches (both of which are integers). The following is an example of what the format might look like. Save the script as 'experiment. m' Write a function 'printHts ' that will receive a vector in this format and will print height of each subjects in inches. printHts(experiments) Joe is 66 inches tall Sally is 86 inches tall

Explanation / Answer


num =[ 33 11];

name={'Joe', 'Sally'};

weight=[200.34 202.45

111.45 11.23];

feet=[5 7];

inches=[6 2];

height=struct('feet', feet, 'inches', inches);


experiment=struct('num',num,'name',name,'weight',weight,'height',height);



function printfHts(experiment)


a= cat(2,(experiment(1).name),' is ', num2str(experiment(1).height.feet(1)*12+experiment(1).height.inches(1)), ' inches tall');

disp(a);

a= cat(2,(experiment(2).name),' is ', num2str(experiment(2).height.feet(2)*12+experiment(2).height.inches(2)), ' inches tall');

disp(a);