MATLAB: Is this code identifying more than one result

data manipulationlogic indexingMATLAB

I have written a code which looks through a database and plots certain things at a time. As far as I can tell, having all of my logic checks individually produces the correct locations and number of elements, but when I put them together it tells me that I have more than one result.
para1 = unique([structure.para1].','rows','stable');
for i = 1:length(para1);
c1 = [structure.para1].'==para1(i);
para2 = unique([structure(c1).para2].','rows','stable');
if length(para2)>1;
hold on
for j = 1:length(para2);
c2 = [structure.para2].'==para2(j);
para3 = unique([structure(c1&c2).para3].','rows','stable');
for k = 1:length(para3);
c3 = [structure.para3].'==para3(k);
set1 = zeros(size(unique(structure(c1&c2&c3).data(:,1)),1),1);
set1(:) = structure(c1&c2&c3).para3;
xs = unique(structure(c1&c2&c3).data(:,1));
for m = 1:length(xs);
c4 = structure(c1&c2&c3).data(:,1)==xs(m);
qm(m) = max(structure(c1&c2&c3).data(c4,10));
end
scatter3(set1,unique(structure(c1&c2&c3).data(:,1)),qm);
clear set1
end
end
hold off
end
end
Calling 'structure(c1&c2&c3).data' brings up the specific data block I am looking for, and c4 does correctly logic the elements I am looking for, but when I call
qm(m) = max(structure(c1&c2&3).data(c4,10));
It returns, 'Expected one output from a curly brace or dot indexing expression, but there were 2 results.' Why is it suddenly looking at multiple data blocks. I suspect it has somehow identified the elements for all para3 values (my actual data has element numbers line up that way), but that makes no sense when c1&c2&c3 does properly identify the single data block I want.
PS if anybody has any better way of reducing this code to not be four for loops I'm open to hearing it.

Best Answer

(c1&c2&3)
Has &3 as the last component, not &c3