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

1 visualización (últimos 30 días)
Mohammad Hasani
Mohammad Hasani el 26 de Nov. de 2021
Comentada: Mohammad Hasani el 27 de Nov. de 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

Respuestas (1)

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

Iniciar sesión para comentar.

Categorías

Más información sobre Calendar en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by