Discover the answers to your questions at Westonci.ca, where experts share their knowledge and insights with you. Discover in-depth solutions to your questions from a wide range of experts on our user-friendly Q&A platform. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.
Sagot :
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
Thank you for choosing our service. We're dedicated to providing the best answers for all your questions. Visit us again. We hope you found what you were looking for. Feel free to revisit us for more answers and updated information. Your questions are important to us at Westonci.ca. Visit again for expert answers and reliable information.