I'm trying to use a for loop and the date commands to calculate the date of Memorial day for next 10 years.
cl = clock; this_year = cl(1)this_years_MDay = ['25-May-' num2str(this_year)];[daynum, day_of_the_Mday] = weekday(this_years_MDay, 'long');day_of_the_Mday = string(day_of_the_Mday);if floor(now)<datenum(this_years_MDay) disp('we are before Mday') years = this_year + [0:9]';else disp('we are after Mday') years = this_year + [1:10]';endfor n = 1:length(years) if datetime == week(22) disp('It could be Mday') else datetime == daynum; disp('It is Mday') endend
Best Answer