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

Create a cell array cells with the numbers 1 2 3 in the 1st row (each in one cel

ID: 3805747 • Letter: C

Question

Create a cell array cells with the numbers 1 2 3 in the 1st row (each in one cell, the vectors [11 121] [12 14] [13 16] in the 2nd row (each in one cell), and the strings 'how' 'are' 'you' in the third row (each in one cell). In one command, assign the numbers stored in the 1st row of the cell array to a new (numerical) vector containing 3 elements (NOT to a new cell array; check the data type in the Workspace). In one command, assign the vectors stored in the 2nd row of the cell array to a new (numerical) matrix with 3 rows and 2 columns such that each vector from the cell array is in one row (NOT to a new cell array: check the data type in the Workspace). Execute the following commands in the Command Window: cells {3,:}, cells (3,:) and [cells {3,:}]. Explain what each command does and the differences in output between the commands.

Explanation / Answer

Answer:

cells= cell(3, 3);
cells{1, 1} = 1;
cells{1, 2} = 2;
cells{1, 3} = 3;

cells{2, 1} = {11,12};
cells{2, 2} = {12,14};
cells{2, 3} = {13,16};

cells{3, 1} = 'how';
cells{3, 2} = 'are';
cells{3, 3} = 'you';
-----------------------------------------------------------------

d)
cells{3,:} => 'how' 'are' 'you'
cells (3,:) => [3,1]='how'
[3,2]='are'
[3,3]='you'
-----------------------------------------------------------------

b) V= cells{1,:}

-----------------------------------------------------------------

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote