필터 지우기
필터 지우기

month number to month name function

조회 수: 40 (최근 30일)
mmmm
mmmm 2020년 4월 23일
편집: Rik 2020년 4월 23일
Create a Matlab function
  댓글 수: 4
madhan ravi
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
Ameer Hamza 2020년 4월 23일
Name of Original OP: miika k
I am adding this to discourage such spamming behavior.

댓글을 달려면 로그인하십시오.

답변 (2개)

Johannes Hougaard
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');

Ameer Hamza
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'

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by