How to create a function, that outputs Weekdays on given date?
이전 댓글 표시
hello everyone,
basically i have to create my own function, which gives me the weekday when i give date. for exp in this format :
input : 26,06,2021
output : Date = 26,06,2021
Day = Saturday
I am trying to write it, but i am not getting any further, i would really appreciate it, if anyone can help me.
답변 (1개)
D = datetime(2021,06,26);
out = day(D,'name')
댓글 수: 4
Mihir Rathod
2021년 11월 1일
Cris LaPierre
2021년 11월 1일
Make an attempt and share it here. I'm purposely trying to not do your assignment for you.
Dianela Jimenez Ramirez
2022년 3월 12일
Hi Cris, your comment has been very helpful! I´m wondering if there is a way to show only day and hide the phrase in the output out = 1×1 cell array. Thank you!
Use the function disp
D = datetime(2021,06,26);
out = day(D,'name');
disp(out{1})
카테고리
도움말 센터 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!