change char class to string class

2 vues (au cours des 30 derniers jours)
Maria
Maria le 18 Juin 2020
Modifié(e) : madhan ravi le 18 Juin 2020
How to change the output from char class to string class ?
function Out=bestSection(Number,Letter,Grades)
[~,ind]=max(Grades);
Out=[num2str(Number(ind)),Letter(ind)];
end
  1 commentaire
Stephen23
Stephen23 le 18 Juin 2020
The most robust and efficient solution is to use sprintf, which also lets you specify the numeric conversion format.

Connectez-vous pour commenter.

Réponse acceptée

madhan ravi
madhan ravi le 18 Juin 2020
Modifié(e) : madhan ravi le 18 Juin 2020
doc string
doc compose % after Stephen's comment , make sure to use "" - double quotes

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by