With ‘K’ defined as 8, this segment:
for i = 1:K
idx = find(DAL(:,K+1) == i);
X(idx,:) = repmat(CENTS(i,:),size(idx,1),1);
end
searches all rows of the ‘K+1’ column of ‘DAL’ for a value that equals the index ‘i’. (The comparison will only match integer values.) It then creates matrix ‘X’ length ‘idx’ rows at a time, using the value ‘idx’ (that is apparently a column vector) returned from the find call to define the rows. It then uses the repmat (essentially ‘replicate matrix’) function to create duplicates of the row vector ‘CENTS(i,:)’ to the row size of the ‘idx’ vector. The 1 as the last argument means that the function creates a vertical (row) replication only, not row-and-column replication.
I added the indentation to make the code easier to read.