I have a data that has xyz information as well as three numbers that group each point together. As an example a row might have [ -1 2 -4 1 2 15] So that atom is at point (-1,2,-4) and it is defined by 1,2,and 15. There is an unknown amount of atoms that have different locations but have the same defined numbers. I want to group all of the atoms that have the same 3 defining numbers in a matrix that is in a cell array (or into structure if that is easier) QN. I have the following code but I am not adding more data to one cell. This is what I have
j=1;for k = 1:(length(TypesQN)-1) for p = 1:(length(locQN)-1) if TypesQN(k,1:4)==locQN(p,4:7) qn=locQN(p,:); QN{j}=qn; j=j+1; end endend
Where the amount of defined numbers is know (TypesQN) and the total dataset length is known (locQN).
Best Answer