MATLAB: Selection of data from matrix

datamatricesselection

I have a dataset lets say a matrix of 100 rows and 5 columns, each row represents a dataset.Now I want to select 5 any rows(datasets) initially, then further I want to select 4 rows(dataset) except initially 5 rows should not be repeated, then next I want to select 10 rows except for initially selected rows (those 9 rows should not be repeated here) in before and so on….. one thing to remember that one rows should be selected once here.

Best Answer

data = randi([-41 78],100,5);
ii = randperm(size(data,1));
k = [5 4 10];
out = mat2cell(data(ii(1:sum(k)),:),k,size(data,2));