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

1 Ansicht (letzte 30 Tage)
Mohammad Hasani
Mohammad Hasani am 26 Nov. 2021
Kommentiert: Mohammad Hasani am 27 Nov. 2021
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

Antworten (1)

Chunru
Chunru am 27 Nov. 2021
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 Kommentar
Mohammad Hasani
Mohammad Hasani am 27 Nov. 2021
I don't want to use built in calendar. That's why I wrote those lines.

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by