Question: using matlab, you will create a vector of structures mathcomm with two fields: variables, and operator. The field variables contains a struct with fields a
using matlab, you will create a vector of structures mathcomm with two fields: variables, and operator. The field variables contains a struct with fields a and b (both of which store doubles). The field operator stores a string describing the binary arithmetic operation between the two variables. The string will have one of the following three possible values: ADD, SUB, and MULT, corresponding to addition (+), subtraction (), and multiplication (*).
The following is an example of what the format of mathcomm should look like.

Problem 3. In this problem, you will create a vector of structures mathcomm with two fields: variables, and operator. The field variables contains a struct with fields a and b (both of which store doubles) The field operator stores a string describing the binary arithmetic operation between the two variables. The string will have one of the following three possible values: ADD, SUB, and "MULT', corresponding to addition subtraction and multiplication The following is an example of what the format of mathcomm should look like mathcomm variables operator 3.0 4.0 ADD 2.0 3.14 MULT 4.0 0.0 SUB Part A Initialize the vector of structures illustrated above, while making sure to preallocate. Then, looping through the struct vector (without assuming its size), perform the respective arithmetic operations, and append the result into a new struct field called result. Your finalized vector of structures mathcomm should have the following format: mathcomm variables operator result 3.0 4.0 ADD 7.0 2.0 3.14 MULT -6.28 4.0 0.0 SUB 4.0 Part B Within a separate for loop, create a cell array camathcomm from the finalized struct vector mathcomm from Part A. Assume the size of mathcomm is not known in advance. The structure of the cell array camathcomm should resemble the structure of the struct vector mathcomm The substructs within the structs of mathcomm should thus coincide with the bottommost subcells within the cells of cell array camathcomm which you are to create. Here is a schematic representation of what the cell array camathcomm might look like 3.01 4.01 I'ADD'117.01 I 2.000-3.14][MULT][-6.28] 4.01 0.01 SUB1[4.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
