month number to month name function
50 ビュー (過去 30 日間)
古いコメントを表示
Create a Matlab function
4 件のコメント
madhan ravi
2020 年 4 月 23 日
編集済み: Rik
2020 年 4 月 23 日
[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
2020 年 4 月 23 日
Name of Original OP: miika k
I am adding this to discourage such spamming behavior.
回答 (2 件)
Johannes Hougaard
2020 年 4 月 23 日
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');
0 件のコメント
Ameer Hamza
2020 年 4 月 23 日
編集済み: Ameer Hamza
2020 年 4 月 23 日
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'
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で String についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!