Main Content

Data Preprocessing

Financial market data for dates and currencies

The representation and quality of data is essential before running an analysis. Financial data is often in formats that require conversion to standard formats. This toolbox provides a suite of tools to organize and transform financial data for analysis.


expand all

now(Not recommended; use datetime) Current date and time as serial date number
datefindIndices of dates in matrix
datevecConvert date and time to vector of components
datetimArrays that represent points in time
yeardaysNumber of days in year
date2timeTime and frequency from dates
datedispDisplay date entries
datenum(Not recommended; use datetime or duration) Convert date and time to serial date number
datestr(Not recommended; use string or char) Convert date and time to string format
time2dateDates from time and frequency
uicalendarGraphical calendar
busdateNext or previous business day
busdaysBusiness days for given period
datemnthDate of day in future or past month
datewrkdyDate of future or past workday
days252busNumber of business days between dates
days360Days between dates based on 360-day year
days360eDays between dates based on 360-day year (European)
days360isdaDays between dates based on 360-day year (International Swap Dealer Association (ISDA) compliant)
days360psaDays between dates based on 360-day year (Public Securities Association (PSA) compliant)
days365Days between dates based on 365-day year
daysactActual number of days between dates
daysaddDate away from starting date for any day-count basis
daysdifDays between dates for any day-count basis
fbusdateFirst business date of month
isbusdayTrue for dates that are business days
lbusdateLast business date of month
thirdwednesdayFind third Wednesday of month
wrkdydifNumber of working days between dates
yearfracFraction of year between dates
createholidaysCreate trading calendars
holidaysHolidays and nontrading days
nyseclosuresNew York Stock Exchange closures from 1885 to 2070
addBusinessCalendarAdd business calendar awareness to timetables (Since R2020b)
accrfracFraction of coupon period before settlement
cpncountCoupon payments remaining until maturity
cpndatenNext coupon date for fixed-income security
cpndatenqNext quasi-coupon date for fixed-income security
cpndatepqPrevious quasi-coupon date for fixed-income security
cpndatepPrevious coupon date for fixed-income security
cpndaysnNumber of days to next coupon date
cpndayspNumber of days since previous coupon date
cpnperszNumber of days in coupon period
cur2fracDecimal currency values to fractional values
cur2strBank-formatted text
dec2thirtytwoDecimal to thirty-second quotation
frac2curFractional currency value to decimal value
thirtytwo2decThirty-second quotation to decimal