How can I create an array to hold the unpicked values from a randsample function?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi all. I have a 1x2012 array with values that go from 1 to 2012 in increments of 1, and I took a randsample so that half of those values would be chosen randomly and put into a 1x1006 array. Now I am trying to create another array that contains the 1006 values that weren't chosen by the randsample. I was wondering how to do this? I'm thinking it is easy to do, but I'm terrible at coding and I haven't found anything online yet that would help. Any help would be very much appreciated!
댓글 수: 0
답변 (1개)
Walter Roberson
2021년 1월 21일
ridx = randperm(length(YourVector));
selected = YourVector(1:end/2);
unselected = YourVector(end/2+1:end);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!