Matlab: Import Data

The first step is to create a connection: f = fred(‘http://research.stlouisfed.org/fred2/’)

The second step is to import the series you want (here M1 money for period 1960 to 2000): M1 = fetch(f, ‘M1SL’, ’01/01/1960′, ’12/31/2000′)

Dates are in Matlab’s datenum format, counts days starting from 01/01/0000. You can convert them using datestr and datevec, graph them with dateticks. Sometimes you will want them in a format telling you the quarter; use datevec, get months, and then turn months to quarters using ceil(‘month’/3).