Split data into 3 sets without repetition

I have a dataset with size of (20132,11). I need to split it into three sets with sizes of 12132,4000 and 4000. I tried to use randsample command, but I dont know how to make this not repetition, thank you!

 채택된 답변

Guillaume
Guillaume 2015년 9월 17일

0 개 추천

It sounds like you want to split the rows randomly. Use randperm for that:
dataset = randi([0 255], 20132, 11); %random data for demonstration
rows = randperm(size(dataset, 1));
splitdata{1} = dataset(rows(1:12132), :);
splitdata{2} = dataset(rows(12133:16132, :);
splitdata{3} = dataset(rows(16133:20132, :);

추가 답변 (0개)

카테고리

질문:

2015년 9월 17일

댓글:

2015년 9월 17일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by