how to print first business dates between years using loops?

1 view (last 30 days)
how to print first business dates between years. for eg lets take from 2010-2020. how to print first business dates for each month beween these years using loop?

Accepted Answer

C B
C B on 27 Oct 2021
alldates = {};
for year =2010:2020
for month=1:12
alldates{end+1}= datestr(fbusdate(year,month));
end
end
vertcat(alldates{:})
ans = 132×11 char array
'04-Jan-2010' '01-Feb-2010' '01-Mar-2010' '01-Apr-2010' '03-May-2010' '01-Jun-2010' '01-Jul-2010' '02-Aug-2010' '01-Sep-2010' '01-Oct-2010' '01-Nov-2010' '01-Dec-2010' '03-Jan-2011' '01-Feb-2011' '01-Mar-2011' '01-Apr-2011' '02-May-2011' '01-Jun-2011' '01-Jul-2011' '01-Aug-2011' '01-Sep-2011' '03-Oct-2011' '01-Nov-2011' '01-Dec-2011' '03-Jan-2012' '01-Feb-2012' '01-Mar-2012' '02-Apr-2012' '01-May-2012' '01-Jun-2012' '02-Jul-2012' '01-Aug-2012' '04-Sep-2012' '01-Oct-2012' '01-Nov-2012' '03-Dec-2012' '02-Jan-2013' '01-Feb-2013' '01-Mar-2013' '01-Apr-2013' '01-May-2013' '03-Jun-2013' '01-Jul-2013' '01-Aug-2013' '03-Sep-2013' '01-Oct-2013' '01-Nov-2013' '02-Dec-2013' '02-Jan-2014' '03-Feb-2014' '03-Mar-2014' '01-Apr-2014' '01-May-2014' '02-Jun-2014' '01-Jul-2014' '01-Aug-2014' '02-Sep-2014' '01-Oct-2014' '03-Nov-2014' '01-Dec-2014' '02-Jan-2015' '02-Feb-2015' '02-Mar-2015' '01-Apr-2015' '01-May-2015' '01-Jun-2015' '01-Jul-2015' '03-Aug-2015' '01-Sep-2015' '01-Oct-2015' '02-Nov-2015' '01-Dec-2015' '04-Jan-2016' '01-Feb-2016' '01-Mar-2016' '01-Apr-2016' '02-May-2016' '01-Jun-2016' '01-Jul-2016' '01-Aug-2016' '01-Sep-2016' '03-Oct-2016' '01-Nov-2016' '01-Dec-2016' '03-Jan-2017' '01-Feb-2017' '01-Mar-2017' '03-Apr-2017' '01-May-2017' '01-Jun-2017' '03-Jul-2017' '01-Aug-2017' '01-Sep-2017' '02-Oct-2017' '01-Nov-2017' '01-Dec-2017' '02-Jan-2018' '01-Feb-2018' '01-Mar-2018' '02-Apr-2018' '01-May-2018' '01-Jun-2018' '02-Jul-2018' '01-Aug-2018' '04-Sep-2018' '01-Oct-2018' '01-Nov-2018' '03-Dec-2018' '02-Jan-2019' '01-Feb-2019' '01-Mar-2019' '01-Apr-2019' '01-May-2019' '03-Jun-2019' '01-Jul-2019' '01-Aug-2019' '03-Sep-2019' '01-Oct-2019' '01-Nov-2019' '02-Dec-2019' '02-Jan-2020' '03-Feb-2020' '02-Mar-2020' '01-Apr-2020' '01-May-2020' '01-Jun-2020' '01-Jul-2020' '03-Aug-2020' '01-Sep-2020' '01-Oct-2020' '02-Nov-2020' '01-Dec-2020'

More Answers (0)

Community Treasure Hunt

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

Start Hunting!