Skip to Main Content
Programming in MATLAB ®: A Problem-Solving Approach by Pearson
book

Programming in MATLAB ®: A Problem-Solving Approach by Pearson

by Ram N. Patel, Ankush Mittal
May 2024
Intermediate to advanced content levelIntermediate to advanced
433 pages
13h 7m
English
Pearson India
Content preview from Programming in MATLAB ®: A Problem-Solving Approach by Pearson
Loops É 109
disp (‘Monday’)
elseif (day == 2)
disp (‘Tuesday’)
elseif (day == 3)
disp (‘Wednesday’)
Example 4.3
The switch-case construct provides a more elegant solution to
Example 4.2 as can be seen from the following code:
selection-2.m
% A switch-case example
day = input(‘Enter a number for the day ( 1 to 7)’)
disp (‘The day is :’ )
switch(day)
case 1
disp (‘Monday’)
case 2
disp (‘Tuesday’)
case 3
disp (‘Wednesday’)
case 4
disp (‘Thursday’)
case 5
disp (‘Friday’)
case 6
disp (‘Saturday’)
case 7
disp (‘Sunday’)
otherwise
disp (‘Not a valid entry for the day’)
end
4.3 Loops
A loop is a structure for repeating certain set ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Applied Numerical Methods Using MATLAB, 2nd Edition

Applied Numerical Methods Using MATLAB, 2nd Edition

Won Y. Yang, Wenwu Cao, Jaekwon Kim, Kyung W. Park, Ho-Hyun Park, Jingon Joung, Jong-Suk Ro, Han L. Lee, Cheol-Ho Hong, Taeho Im
MATLAB Recipes: A Problem-Solution Approach

MATLAB Recipes: A Problem-Solution Approach

Michael Paluszek, Stephanie Thomas
Practical MATLAB Deep Learning: A Projects-Based Approach

Practical MATLAB Deep Learning: A Projects-Based Approach

Michael Paluszek, Stephanie Thomas, Eric Ham

Publisher Resources

ISBN: 9781306983440Publisher Website