The code to fix is not the one you show unfortunately, It's the code before that which creates all these numbered I variables.
Do not create numbered variables. Matlab already has a way of storing together things with an index: matrices and cell arrays. Instead of all these Ix_y you should have a single I variable (and a better, more meaningful name wouldn't hurt) that is a cell array with I{1} a 3121x10 matrix, |I{2} a 3554x10 matrix, and I{3} and 3510x10 matrix (each made by horizontally concatenating [Ix, Ix_0, ..., Ix_9]. With that your correct code is trivial:
num_int = numel(I); %no more hardcoded size
for k = 1:num_int
if count_vector(k) == 0
y_data_low{k} = I{k}(:, 2:5);
y_data_high{k} = I{k}(:, 6:10);
end
end
To be honest, there isn't even a need for y_data_low and y_data_high since it's simply I{k}(:, 2:5) and I{k}(:, 6:10) respectively.