0
0
MATLABdata~10 mins

Cell array creation in MATLAB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a 1x3 cell array named C.

MATLAB
C = [1](1,3);
Drag options to blanks, or click blank then click option'
Alist
Barray
Cmatrix
Dcell
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'array' or 'matrix' instead of 'cell' to create cell arrays.
Trying to create cell arrays with square brackets.
2fill in blank
medium

Complete the code to assign the string 'hello' to the first cell of cell array C.

MATLAB
C[1] = 'hello';
Drag options to blanks, or click blank then click option'
A{1}
B[1]
C(1)
D(1,1)
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses or square brackets instead of curly braces for cell content assignment.
Using multiple indices when only one is needed for a 1D cell array.
3fill in blank
hard

Fix the error in the code to create a 2x2 cell array with numbers 1 to 4 inside.

MATLAB
C = [1](2,2);
C[2] = 1;
C[3] = 2;
C[4] = 3;
C[5] = 4;
Drag options to blanks, or click blank then click option'
Acell
B(1,1)
C{1,1}
D(1)
E{1}
F(1,2)
G{1,2}
H(2,1)
I{2,1}
J(2,2)
K{2,2}
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses instead of curly braces for cell content assignment.
Using single index for 2D cell array assignment.
4fill in blank
hard

Fill both blanks to create a cell array with mixed types: a string and a numeric array.

MATLAB
C = [1](1,2);
C[2] = 'text';
Drag options to blanks, or click blank then click option'
Acell
B{1,1}
C{1,2}
D(1,2)
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses instead of curly braces for assignment.
Using wrong indices for the cell assignment.
5fill in blank
hard

Fill all three blanks to create a 2x2 cell array and assign a string, a number, and a vector to different cells.

MATLAB
C = [1](2,2);
C[2] = 'hello';
C[3] = 42;
C{2,2} = [1, 2, 3];
Drag options to blanks, or click blank then click option'
Acell
B{1,1}
C{1,2}
D{2,1}
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses instead of curly braces for assignment.
Mixing up the indices for cell assignment.