I think you're probably after this:
for k=1:30
for i=1:150
sample=meas(i,:);
training1=meas;
training1(i,:)=[];
group_sample=group(i);
group_training=group;
group_training(i)=[];
c(i,k)=knnclassify(sample,training1,group_training,k);
end
A=confusionmat(group, c(:,k));
mean_error(k)=mean(A(:));
std_error(k)=std(A(:));
end
So in other words only find the confusion matrix after the cross-validation loop.