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 Center および File ExchangeCalendar についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by