At Westonci.ca, we connect you with experts who provide detailed answers to your most pressing questions. Start exploring now! Discover detailed solutions to your questions from a wide network of experts on our comprehensive Q&A platform. Explore comprehensive solutions to your questions from a wide range of professionals on our user-friendly platform.
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
Thanks for stopping by. We are committed to providing the best answers for all your questions. See you again soon. Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. We're here to help at Westonci.ca. Keep visiting for the best answers to your questions.