Effacer les filtres
Effacer les filtres

month number to month name function

31 vues (au cours des 30 derniers jours)
mmmm
mmmm le 23 Avr 2020
Modifié(e) : Rik le 23 Avr 2020
Create a Matlab function
  4 commentaires
madhan ravi
madhan ravi le 23 Avr 2020
Modifié(e) : Rik le 23 Avr 2020
[expletive] why would you do that? So annoying when people do this. So when you ask something online isn’t that obvious that it’ll visible for everyone?? Come on!!
Ameer Hamza
Ameer Hamza le 23 Avr 2020
Name of Original OP: miika k
I am adding this to discourage such spamming behavior.

Connectez-vous pour commenter.

Réponses (2)

Johannes Hougaard
Johannes Hougaard le 23 Avr 2020
This snippet should do it using existing functions.
month_number = 11;
month_name = datestr(datetime(1,month_number,1),'mmmm');
If you want it as a function just add a function header
function month_name = month_number2name(month_number)
month_name = datestr(datetime(1,month_number,1),'mmmm');

Ameer Hamza
Ameer Hamza le 23 Avr 2020
Modifié(e) : Ameer Hamza le 23 Avr 2020
This is one of the option
name = monthName(12);
function name = monthName(num)
name = month(datetime(1,num,1), 'name');
name = name{1};
end
Result:
name =
'December'

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by