0
0
MATLABdata~5 mins

First MATLAB program - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Ashow()
Bprint()
Cecho()
Ddisp()
How do you start a comment in MATLAB?
A%
B#
C//
D/*
What will this code print?<br>
disp('Hi!')
AHi!
Bdisp('Hi!')
CError
DNothing
What is the correct way to run a script named test.m?
Aexecute test.m
Brun test.m
Ctest
Dstart test
What file extension do MATLAB scripts use?
A.mat
B.m
C.mlx
D.txt
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.