Professional Documents
Culture Documents
Lec 3
Lec 3
Matlab Basics
Content: Today we will see
Some basic rules about Matlab coding
The template of a Matlab program
How to display text messages in Matlab
Some common errors in Matlab coding
Some good practices
My First Program
Write a Matlab program that displays the
following message on the screen
In the command prompt window type the name of the file in which your
program is saved (without the extension) followed by semincoln. Them press
Enter
Matlab program template: script
template
=
The program contains only the instructions. To run the program, type the type the
name of the file in which your program is saved (without the extension) followed
by semincoln. Them press Enter
Matlab program template: script
template
=
\n is a special character that make a new line after printing the text that comes
before .
MATLAB comments
Comments are explanatory notes
Increase the program readability
They are ignored by the compiler
Mohamed
Abdul-Aziz
Exercise: solution
Analysis:
Output : text showing Name and
Surname in separate lines
Input: None
Process: Display the text mentioned
above
Exercise: solution (cont)
1st solution
2nd solution