function X = readAllLwn(ext)
% READSPMR  - Reads all spmr files from cruises found in Diatom
%
% This searches through all Cruise directories for gp*\spmr directories
% Then takes the seabass format files and readsa ll of them in to a 
% data structure
%
% Use as: x = readspmr
%         x = readspmr(ext)
%
% Inputs: ext = An extension (default = '.lwn', other option is '.ocp')
%

% Brian Schlining
% 21 Dec 1999

if ~nargin
   ext = '.lwn';
end


names = getspmrdirs;
[r c] = size(names);
k = 0;
for i = 1:r
   thisDir = deblank(names(i,:));
   lwnFile{i} = getfname(fullfile(thisDir, ['*' ext]));
   [rr cc] = size(lwnFile{i});
   for j = 1:rr
      fullName = fullfile(thisDir, deblank(lwnFile{i}(j,:)));
      warning('off')
      buf = readSpmrLwn(fullName);
      warning('on')
      if isfield(buf, 'PROSOFT')
         fprintf(1, 'Reading %s\n', fullName)
         k = k + 1;
         X{k} = buf;
      end
      
   end
   
end