How to make a switch statement work for a matrix

2 visualizaciones (últimos 30 días)
Synthia Caruvana
Synthia Caruvana el 9 de Abr. de 2019
Respondida: Synthia Caruvana el 9 de Abr. de 2019
I am trying to convert letters to numbers using the following switch algorithm:
switch grades
case {'A','a'}
GP = 4;
case {'B','b'}
GP = 3;
case {'C','c'}
GP = 2;
case {'D','d'}
GP = 1;
otherwise
GP = 0;
end
but my variable "grades" is a matrix with 16 characters and it's only returning an answer for one of the values when I run it through. How do I make it give me another matrix with the numbers for all the corresponding letters?

Respuestas (1)

Synthia Caruvana
Synthia Caruvana el 9 de Abr. de 2019
nevermind i got it fam

Categorías

Más información sobre Creating and Concatenating Matrices 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!

Translated by