MATLAB: HOW TO DIVIDE RANDOMLY

data mining

a=[1 9 2 4 3 5 4 6 5 1 6 9 7 0 8 3 9 1 0 2 3 6 3 4 3 7 8 1 8 7 9 2 0 3 4 6 5 7 8 9 ] i want to divide this data into 5 groups RANDOMLY so taht the values in the column 1 and 2 should not change……. have to do this for large data also,can anyone help the output must be

Best Answer

r = 5;
n = size(a,1);
k = n/r;
groups5 = reshape(permute(reshape(a(randperm(n),:),k,[],2),[1 3 2]),k,[]);