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

% The following code is written in MATLAB: % ___________________________________

ID: 3538998 • Letter: #

Question


% The following code is written in MATLAB:

% ____________________________________

%

% cA = {{true, 'wrong'}, [7 5 4 7], ['CS' '1371']};

% charCell = {'A','B','C','D'};

% A = length(cA);

% B = cA{1}{2}(3);

% temp = cA;

% temp{1} = [ ];

%

% var = class(temp{2}(1));

%

% C = strcmp(var, 'double');

%

% tempD = {cA 'addition'};

% D = length(tempD);

% E = charCell([3 1 2 4]);

% ___________________________________

%

% After the above script is run, what are the values of the following variables?

% If a line produces an error, answer ERROR for that variable and assume the rest

% of the code is still run.

%

% Enter the values as they would be entered into MATLAB :

% - vectors and arrays in [square brackets]

% - strings in 'single quotes'

% - logicals as true or false

% - cell arrrays in {curly braces}

% - structure arrays by using the struct() function

%

% A =

%

% B =

%

% C =

%

% D =

%

% E =

Explanation / Answer

A = 3
B = o
C = 1
D = 2
E =
{
[1,1] = C
[1,2] = A
[1,3] = B
[1,4] = D
}