Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB PROBLEM - [PLEASE DO NOT WRITE ON PAPER] Advanced Cell and Structure Arra

ID: 3601532 • Letter: M

Question

MATLAB PROBLEM - [PLEASE DO NOT WRITE ON PAPER]

Advanced Cell and Structure Arrays

Must use Iteration to solve problem.

1. Create the following cell array A using index notation (ex. A(1,1]) and concatenation. 2x2 cell 1 "Matlab' 2 [3,9:8,2] 28:5] Simulink a. b. c. d. How would you access the "t" in “Matlab" as a character? How would you access the word "Simulink" as a character array? As a cell? How would you access each number of the two numeric arrays? Create a 2x3 cell array “B" with contents of your choosing (include a string, a single value, and a matrix) and horizontally concatenate it with "A" 2. Create a structure array using the table below using direct field notation (ex structure.field = XX) and the struct funcion. The fields are the following. "Name", "Year", "ERA", and “IP". Fill the fields using the first row of the below table Year: ERA Name: Harang Coffey 2002,2003,20043.54, 4.67, 2.1 2002,2003,20049.78, 12.1, 7.18 Valentine 2002,2003,20044.56, 1.18, 8.21 Claussen 2002,2003,20049.21, 7.38,1.76 278,192, 56 145, 267, 228 133, 184, 237 121, 280, 275 Create 3 more similar structures and append them to the original to create a structure array a. b. Add the field "ER" to each structure in the array, and assign a value to each using ERA= 9*ER/IP

Explanation / Answer

According to Chegg Guidelines, multiple questions cannot be posted at once.
I have answered the first question. I hope it is clear.
All the parts have been answered and how to access each element in cell and
horizontal concatenation has also been shown. Kindly go through. If you have further queries.
Kindly comment.
*******************************************************************
1.To create a cell A of 2X2 we use:
A = {'Matlab','Simulink';[3,9;8,2],[2;8;5]}

OR,

A{1,1}='Matlab'
A{1,2}='Simulink'
A{2,1}=[3,9;8,2]
A{2,2}=[2;8;5]

a) To access 't' in Matlab
A{1}(3)

b)To access 'Simulink'
A{3}

c)To access each number:
A{2}(1)
A{2}(3)
A{2}(2)
A{2}(4)

OR

for i=1:4
    A{2}(i)
end


A{4}(1)
A{4}(2)
A{4}(3)

OR
for i=1:3
    A{4}(i)
end

d)To create the 2X3 cell:
B = {'one', 'two', 'three'; 1, 2, [1 2 3;4 5 6;7 8 9]}
horzcat(A,B)


****************************************************************************
I hope this helps you.
If you find my answer helpful,
Kindly rate the answer.
All the best :)