0
0
MATLABdata~15 mins

Why MATLAB is used in engineering and science - See It in Action

Choose your learning style9 modes available
Why MATLAB is used in engineering and science
📖 Scenario: You are an engineering student learning how MATLAB helps solve real-world problems in science and engineering.
🎯 Goal: Build a simple MATLAB script that shows key reasons why MATLAB is popular in engineering and science.
📋 What You'll Learn
Create a cell array called reasons with 4 exact reasons why MATLAB is used
Create a variable called count to store the number of reasons
Use a for loop with variable i to print each reason with its number
Print the total number of reasons at the end
💡 Why This Matters
🌍 Real World
Engineers and scientists use MATLAB to quickly analyze data, perform calculations, and visualize results in many fields like robotics, aerospace, and biology.
💼 Career
Knowing MATLAB helps you solve technical problems efficiently and is a valuable skill for jobs in engineering, research, and data analysis.
Progress0 / 4 steps
1
Create the list of reasons
Create a cell array called reasons with these exact entries: 'Easy matrix operations', 'Built-in scientific functions', 'Visualization tools', 'Wide engineering toolbox'.
MATLAB
Need a hint?

Use curly braces {} to create a cell array of strings in MATLAB.

2
Count the number of reasons
Create a variable called count and set it to the number of elements in reasons using the length function.
MATLAB
Need a hint?

Use length(reasons) to find how many items are in the cell array.

3
Print each reason with a number
Use a for loop with variable i from 1 to count to print each reason preceded by its number and a dot. Use fprintf with format '%d. %s\n'.
MATLAB
Need a hint?

Use for i = 1:count and fprintf to print each reason with its number.

4
Print the total number of reasons
Print the total number of reasons using fprintf with the exact text: 'Total reasons: %d\n' and the variable count.
MATLAB
Need a hint?

Use fprintf('Total reasons: %d\n', count); to print the total count.