Answer:
im assuming this is required to be done in matlabs.
Explanation:
experiment.m
% Create an "experiments" vector of structures
% variable, and pass it to a function that will
% print the height of each subject
experiments(2) = struct('ID', 2222); 'name'; 'Ann'; ...
'weights'; '106.2, 106.6.9'; 'height'; struct('feet',5, 'inches',3);
experiments(1) = struct('ID',1111);'name'; 'Bob'; ...
'weights'; '150.1, 149.6'; 'height'; ...
struct('feet', 6, 'inches', 1);
printhheight(experiments)
printhheight.m
function printhheight(experiments)
% Prints height of every subject
% Format of call: prinths(experiments vector)
% Does not return any values
for i = 1 : length(experiments), high = height(experiments(i)*height);
fprintf('%s is %d inches tall\n', ...
experiments(i).name, high)
end
end
height.m
function ht = height(expstruct)
% Calculates height in inches of a subject
% Format of call: height(experiment struct)
% Returns height in inches
ht = expstruct.feet*12+expstruct.inches;
end