SWich/case code
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
1 comentario
Geoff Hayes
el 19 de Abr. de 2021
Editada: Geoff Hayes
el 19 de Abr. de 2021
Jorge - since this is homework, please discuss what you have attempted so far. If you have a specific question, then please ask it so that we can get a better idea of where you might be stuck.
Respuestas (1)
Shivang Srivastava
el 23 de Abr. de 2021
I would recommend you try to solve the question yourself before going through the solution. Here is the solution for your reference:
function [output] = switchcaseWeekdays(n)
switch n
case 1
output = "Sunday";
case 2
output = "Monday";
case 3
output = "Tuesday";
case 4
output = "Wednesday";
case 5
output = "Thursday";
case 6
output = "Friday";
case 7
output = "Saturday";
otherwise
output = "Not a valid input";
end
end
0 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!