1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Leya [2.2K]
3 years ago
12

Create a vector of structures experiments that stores information on subjects used in an experiment. Each struct has four fields

: ID, name, weights, and height. The field ID is an integer, name is a string, weights are a vector with two values in pounds (both of which are double values), and height is a struct with fields feet and inches (both of which are integers). The following is an example of what the format might look like.
Experiments
ID Name Weights Height (feet) Icnhes
1 2
1 1111 Bob 150.1 149.6 6 1
2 2222 Ann 106.2 106.6 5 3

Write a function printhheight that will receive a vector of structures in this format and will print the name, ID and height of each subject in inches (1 foot = 12 inches). This function calls another function height that receives a height struct and returns the total height in inches. This function could also be called separately.
Computers and Technology
1 answer:
ella [17]3 years ago
7 0

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

You might be interested in
What is database design?
finlep [7]

Answer: Database design is the model created of data/information for any particular organization .the relation between the information and which data is to be stored is the most important factor for designing .These parameters are decided by the designer of the database.

After the decision of the designed the data is invoked in the database .The data representation in the theoretical manner is known as ontology.The classification and relation defining is the purpose of the database design.

3 0
3 years ago
1) What are the six (6) core elements of developing a whole person? Explain
VashaNatasha [74]

Answer:

Here

Explanation:

Hope that was helpful!

4 0
4 years ago
What are some recent inventions that have improved the quality of your life?
Eva8 [605]
Phones, they help me with school work and provide entertainment.
4 0
3 years ago
Amir is searching on his computer for a file that he created and saved in Pixlr's native file format. Which type of file should
zimovet [89]
Pixlr uses .pxd files as its native format.
7 0
3 years ago
Which formula should Gemima use to show the
Shalnov [3]
The answer is
Sum(above)
3 0
3 years ago
Read 2 more answers
Other questions:
  • Nancy would like to configure an automatic response for all emails received while she is out of the office tomorrow, during busi
    13·2 answers
  • You have found statistics on the Internet that you would like to use in your speech.
    6·1 answer
  • Discussion group may have a___________ who monitors the postings and enforces the sides rules​
    13·1 answer
  • Users at UC need to be able to quickly create a Resource record from the Project record's Chatter feed How should the App Builde
    10·1 answer
  • All dogs = 199999990158161231
    11·2 answers
  • Computer has brought radical change in every field​
    6·1 answer
  • What are the components of computer system??<br>​
    10·2 answers
  • Complete the code to finish this program to analyze the inventory for a store that sells purses and backpacks. Each record is co
    13·1 answer
  • To find detailed information about the origin of an email message, look at the ________________.
    11·1 answer
  • Keith would like to compare data he has collected from research. The data includes the electrical output
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!