Recall & Review
beginner
What is the command to display text in MATLAB?
The command
disp() is used to display text or variables in MATLAB.Click to reveal answer
beginner
How do you write a comment in MATLAB?
Use the percent sign
% at the start of a line or after code to add a comment.Click to reveal answer
beginner
What does the following MATLAB code do?<br>
disp('Hello, world!')It prints the text Hello, world! to the command window.
Click to reveal answer
beginner
How do you run a MATLAB script named
hello.m?Type the script name
hello (without .m) in the command window and press Enter.Click to reveal answer
beginner
What is the file extension for MATLAB scripts?
MATLAB scripts are saved with the
.m file extension.Click to reveal answer
Which command shows text output in MATLAB?
✗ Incorrect
The
disp() command is used to display text or variables in MATLAB.How do you start a comment in MATLAB?
✗ Incorrect
Comments in MATLAB start with the percent sign
%.What will this code print?<br>
disp('Hi!')✗ Incorrect
The
disp() function prints the text inside the quotes.What is the correct way to run a script named
test.m?✗ Incorrect
In MATLAB, you run a script by typing its name without the
.m extension.What file extension do MATLAB scripts use?
✗ Incorrect
MATLAB scripts are saved with the
.m extension.Explain how to write and run your first MATLAB program that prints 'Hello, world!'
Think about how you show messages and how you run scripts in MATLAB.
You got /4 concepts.
Describe how to add comments in MATLAB and why they are useful.
Comments help others and yourself understand your code.
You got /4 concepts.