Matlab has an inbuilt function for this, but this one allows for more control, letting you specify the frequency and 'transformation' (eg. level, log, percentage change on year ago). Dates should be ...