MATLAB: How to extract certain years from matrix

extractfor loop

NA_tracks is a matrix with three columns: 1)year,2)longitude, and 3)latitude. I want only the longitude and latitude (columns 2 and 3) for specific years (1987,1998,1999,2001,2005,2006,2010,2012,2013,2014). Years are in chronological order, but there are many repeats of each. When I run the script below, I get a matrix LAWP of zeros. Does anyone have a suggestion on what I'm doing wrong and what I can do to get only the specified coordinate pairs?
%%Extract LAWP years
LAWP = zeros(length(NA_tracks),2); %Create empty matrix for LAWP year tracks
for i = 1:length(NA_tracks)
if NA_tracks(i,1) == 1987 || 1998 || 1999 || 2001 || 2005 || 2006 ...
|| 2010 || 2012 || 2013 || 2014;
LAWP(i,:) = NA_tracks(i,2:3);
elseif NA_tracks(i,1) == 1985 || 1986 || 1988 || 1989 || 1990 || 1991 ...
|| 1992 || 1993 || 1994 || 1995 || 1996 || 1997 || 2000 || 2002 ...
|| 2003 || 2004 || 2007 || 2008 || 2009 || 2011;
LAWP(i,:) = NaN;
end

Best Answer

Use ismember for this:
NA_tracks = [randi([1980 2015], 100, 1) (1:100)' (1:100)']; %random data for demo
years = [1987,1998,1999,2001,2005,2006,2010,2012,2013,2014];
LAWP = NA_tracks(ismember(NA_tracks(:, 1), years), [2 3]);