function batchresults = extractInfoFromBatchresults(batchresults,varargin)
% varargin should contain (1) column, (2) value
% batchresults = load('D:\UCIT_Projects\Projecten\H 5016 13 Kustplaatsen\batchresults.txt')
% %1990   9   10683   36       5.70       8.08      13.20    -166.98   74540.92   453455.67    -173.73   74546.09   453451.33     500.47     125.12     618.56   0.000010    0
% batchresults = extractInfoFromBatchresults(batchresults,1,2006)	 % sort on years.
% batchresults = extractInfoFromBatchresults(batchresults,2,9)       % sort on area.
% batchresults = extractInfoFromBatchresults(batchresults,3,10683)   % sort on transectID.
% batchresults = extractInfoFromBatchresults(batchresults,4,36)      % sort on calcMeth.
% batchresults = extractInfoFromBatchresults(batchresults,8,'all')   % get all Xp.
% batchresults = extractInfoFromBatchresults(batchresults,11,'all')  % get all Xr.
% batchresults = extractInfoFromBatchresults(batchresults,17,0.0001) % sort on norm.

try 
    column = varargin{1};
end
try
    value  = varargin{2};
end

if exist('column','var') & exist('value','var')
    id = [];
    for i = 1: length(value)
    id = [id ;find(batchresults(:,column)==value(i))];
    end
    batchresults = batchresults(id,:);
elseif exist('column','var') & ~exist('value','var')
    batchresults = batchresults(:,column);
elseif exist('column','var') & strcmp(lower(value),'all')
    batchresults = batchresults(:,column);
end




