Code covered by the BSD License  

Highlights from
Display Stock Data

from Display Stock Data by Peter Webb
Internet enabled data analysis and visualization.

year(d)
function y = year(d)
% Return the year, given a string date
c = datevec(datenum(d(:)));
y = c(:,1);

Contact us at files@mathworks.com