Here's what I finally figured out. I'm certain that improvements could be made as I'm not an "efficient" coder. I welcome input.
for i = 1:length(xinds) % loop through the planes
k = 1;
yzconlev{i} = contourc(zdim,ydim,squeeze(uavgdef(xinds(i),:,:))',levs); % create contours
[yzczdim{i},yzcydim{i},yzcuavgdef{i}] = C2xyz(yzconlev{i});
for j = 1:length(yzcuavgdef{i}) % loop through the contour levels in each plane
conin{i}{j} = find(yzcydim{i}{j}~=ydim(1) & yzcydim{i}{j}~=ydim(end)...
& yzczdim{i}{j}~=zdim(1) & yzczdim{i}{j}~=zdim(end)); % find contours that don't touch
% edges of domain to exlude open contours
if size(conin{i}{j}) == size(yzcydim{i}{j})
if size(conin{i}{j}) == size(yzczdim{i}{j})
iny{i}{k} = yzcydim{i}{j}; % create sets of y and z coords for only open contours
inz{i}{k} = yzczdim{i}{j};
k = k+1;
end
end
end
for j = 1:length(iny{i})
concenter{i}(j,:) = [mean(inz{i}{j}),mean(iny{i}{j})]; % find center of open contours
end
incen{i} = find(concenter{i}(:,1)<1 & concenter{i}(:,1)>-1 ...
& concenter{i}(:,2)<1 & concenter{i}(:,2)>-1); % find centers that are within "middle"
inconcen{i} = concenter{i}(incen{i},:); % subset of centers in "middle"
for j = 1:length(incen{i})
inycen{i}{j} = iny{i}{incen{i}(j)}; % subset of contours with centers in "middle"
inzcen{i}{j} = inz{i}{incen{i}(j)};
conradii{i}{j} = sqrt((inconcen{i}(j,1)-inzcen{i}{j}).^2+...
(inconcen{i}(j,2)-inycen{i}{j}).^2); % R, radii of contours with centers in "middle"
conavgradius{i}(j) = mean(conradii{i}{j}); % average radius of each contour
end
gt1{i} = find(conavgradius{i} >= 1); % find average radii greater than one
radgtone{i} = conavgradius{i}(gt1{i}); % subset of average radii greater than one
if isempty(radgtone{i}) == 1
radgtone{i} = NaN; % need this for max to work below
end
avgradgtone(i) = nanmean(radgtone{i});
medradgtone(i) = nanmedian(radgtone{i});
maxradgtone(i) = max(radgtone{i});
inconcengt1{i} = inconcen{i}(gt1{i},:); % subset of centers with average radii greater than one
for j = 1:length(gt1{i})
inycengt1{i}{j} = inycen{i}{gt1{i}(j)}; % subset of contours with average radii greater than one
inzcengt1{i}{j} = inzcen{i}{gt1{i}(j)};
end
end