Matlab Using Switch Case and write a script that prompts the

Matlab:

Using Switch Case and write a script that prompts the user to enter a day of the week and then show that the day is a weekday or weekend day.

Solution

Using simple switch case in matlab :

day = input(\'Enter day name: \', \'s\');
switch day
case \'Sunday\'
fprintf(\'Weekend\ \')
case \'Monday\'
fprintf(\'Weekday\ \')
case \'Tuesday\'
fprintf(\'Weekday\ \')
case \'Wednesday\'
fprintf(\'Weekday\ \')
case \'Thursday\'
fprintf(\'Weekday\ \')
case \'Wednesday\'
fprintf(\'Weekday\ \')
case \'Friday\'
fprintf(\'Weekday\ \')
case \'Saturday\'
fprintf(\'Weekend\ \')
otherwise
fprintf(\'Invalid day\ \');
  
end

Matlab: Using Switch Case and write a script that prompts the user to enter a day of the week and then show that the day is a weekday or weekend day.SolutionUsi

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site