%I used this to import Rrs from the P files
%Modify as needed....

p = 0;
for k = 1:10 %cycles through 10 files
p = p+1;
angle = 0:10:90;
fid=fopen(['PEx_' num2str(angle(k)) '.txt']);
c = textscan(fid,'%s','delimiter','\n');
fclose all
idx= [];
for n = 1:length(c{1})
    a = [];
a = strfind(c{1}{n},'Rrs'); %finds Rrs header
if ~isempty(a)
    idx = [idx;n];
end
end
idx = idx(1:2:40); %number of wavelengths used in run)

i = 0;
for j = 1:length(idx) 
    i = i+1;
    row = idx(j)+13;
    Rrs(i,p) = str2num(c{1}{row}(97:110)); 
    Rho(i,p) = str2num(c{1}{row}(112:119));
end
end