How do I add a new column to a table which is a binary or intiger depending upon if the Date is a holiday or not?
Show older comments
I want to create a new variable called Holiday which is equal to an integer of my choosing depending upon if the Date in the same row of the table is a holiday or not. Some holidays mean more than others for this model so I want to return an integer of differing values for different holidays if possible. 4th of july would be a 3 (for example) and Veteran's Day would be a 1.
6 Comments
Guillaume
on 24 Oct 2017
You already know how to add a column to a table. So just go ahead and do it. I'm not sure what it is you're asking. If it is how to identify a holiday, as far as I know there is no such function in matlab so you'll have to write one yourself. If you need help with that, you need to give a lot more details on what dates you consider a holiday.
per isakson
on 24 Oct 2017
- The financial toolbox has a function, holidays, (Holidays and nontrading days).
- google "bank holiday" and notice it's different for nearly every country.
T4H14
on 24 Oct 2017
T4H14
on 24 Oct 2017
per isakson
on 24 Oct 2017
Edited: per isakson
on 24 Oct 2017
- AFAIK: info on holidays is not available in Matlab, except for the financial toolbox where the number of trading days is important.
- I once made a function for Sweden. I found the data I needed on a governmental web-page.
- See the thread NERC holiday calendar
Peter Perkins
on 16 Nov 2017
T4H14, you probably want to use a categorial variable with categories named something like Non-Holiday, US-Holiday, and NERC-Holiday.
Accepted Answer
More Answers (0)
Categories
Find more on Holidays / Seasons in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!