Getting the a day of a month based on Vac(day,month)

조회 수: 1 (최근 30일)
Mohammad Hasani
Mohammad Hasani 2021년 11월 26일
댓글: Mohammad Hasani 2021년 11월 27일
Currently, I'm trying to write a program to get both day and month information and as a result, show how the month x list will be arranged if it starts with the given number. For example, I could get this with (31.3), but my problem is that I cannot make it dynamic based on numbers and the start of the month doesn't change. Would it be better to write it with a 1D array?
day = input(promptDay);
nday = input(promptNday);
x = zeros([1,35]);
Cnt = 1;
for i = day:nday+day - 1
for j = 1:5
for k = 1:7
if x (j*k) == 0
disp(' ')
else
disp (x(j*k)
if [i] == zeros
disp(' ')
x (i) = Cnt;
Cnt = Cnt + 1;
end

답변 (1개)

Chunru
Chunru 2021년 11월 27일
calendar(2021, 3)
Mar 2021 S M Tu W Th F S 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 0 0 0 0 0 0 0 0 0 0
  댓글 수: 1
Mohammad Hasani
Mohammad Hasani 2021년 11월 27일
I don't want to use built in calendar. That's why I wrote those lines.

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

카테고리

Help CenterFile Exchange에서 Calendar에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by