Recall & Review
beginner
What is a cell array in MATLAB?
A cell array is a data type in MATLAB that can hold different types of data in each cell, such as numbers, strings, or even other arrays.
Click to reveal answer
beginner
How do you create an empty cell array of size 3-by-2?
Use the syntax
cell(3,2) to create a 3-by-2 empty cell array.Click to reveal answer
intermediate
What is the difference between
{} and () when creating cell arrays?{} is used to create or access cell contents, while () is used to access cells themselves as containers.Click to reveal answer
beginner
How do you create a cell array with mixed data types, for example a number and a string?
Use curly braces with comma-separated values, like
{42, 'hello'} to create a cell array with a number and a string.Click to reveal answer
intermediate
What happens if you assign a value to a cell array element that does not exist yet?
MATLAB automatically expands the cell array size to include the new element, filling any gaps with empty cells.
Click to reveal answer
Which syntax creates a 2-by-2 cell array with elements 1, 'a', [3 4], and true?
✗ Incorrect
Curly braces with semicolon and comma separate rows and columns to create a cell array with mixed types.
What does
cell(4,1) create in MATLAB?✗ Incorrect
cell(4,1) creates a cell array with 4 rows and 1 column, all cells empty.How do you access the content of the first cell in a cell array
C?✗ Incorrect
Curly braces
{} access the content inside the cell.What is the result of
C = {1, 2; 3, 4}; size(C)?✗ Incorrect
The cell array has 2 rows and 2 columns, so size returns [2 2].
If you assign
C{3,3} = 'new' to a 2-by-2 cell array C, what happens?✗ Incorrect
MATLAB automatically expands the cell array to include the new index, filling gaps with empty cells.
Explain how to create a cell array with different types of data and how to access its elements.
Think about how you mix numbers and strings inside curly braces.
You got /4 concepts.
Describe what happens when you assign a value to a cell array element outside its current size.
Imagine stretching a container to fit a new item.
You got /3 concepts.