0
0
MATLABdata~15 mins

Cell array creation in MATLAB - Mini Project: Build & Apply

Choose your learning style9 modes available
Cell array creation
📖 Scenario: You are organizing a small collection of different types of data about fruits. You want to store their names, colors, and average weights together in a flexible container.
🎯 Goal: Create a cell array in MATLAB that holds the fruit names, their colors, and their average weights. Then, display the cell array.
📋 What You'll Learn
Create a cell array called fruits with exactly three rows and two columns.
The first row should contain the fruit names: 'Apple' and 'Banana'.
The second row should contain the colors: 'Red' and 'Yellow'.
The third row should contain the average weights in grams: 150 and 120.
Display the entire fruits cell array using disp.
💡 Why This Matters
🌍 Real World
Cell arrays let you store mixed data types together, like names, numbers, and descriptions, which is common in data analysis and reporting.
💼 Career
Knowing how to create and manipulate cell arrays is useful for engineers and scientists who work with diverse datasets in MATLAB.
Progress0 / 4 steps
1
Create the cell array fruits
Create a cell array called fruits with three rows and two columns. The first row should have 'Apple' and 'Banana'.
MATLAB
Need a hint?

Use curly braces {} to create a cell array. Separate rows with semicolons ;.

2
Add colors to the second row
Add the colors 'Red' and 'Yellow' to the second row of the fruits cell array.
MATLAB
Need a hint?

Replace the empty strings in the second row with the color names.

3
Add average weights to the third row
Add the average weights 150 and 120 to the third row of the fruits cell array.
MATLAB
Need a hint?

Replace the empty strings in the third row with the numeric weights.

4
Display the fruits cell array
Use disp(fruits) to display the entire fruits cell array.
MATLAB
Need a hint?

Use disp to show the contents of the cell array in the command window.