I have an array of 10 by 6 and i want to randomly select rows from the array ?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have an array which is 10 by 6. the array is data. I want to be able to select random rows from the array and to be assigned to ii and jj. And also want to make sure that ii and jj are never the same.I have done that part but i am having difficulty selecting the random rows from the array.
pair = [];
for ii =1:p
for jj=1:p
if (ii~=jj)
newPair =[ii,jj];
pair= [pair; newPair];
end
end
end
댓글 수: 1
Adam
2015년 3월 5일
You already asked this question or one very similar in which someone is attempting to provide you with an answer. Just expand on the question in the other thread since it is not closed and it is essentially just an extension of an unclear question!
채택된 답변
Sean de Wolski
2015년 3월 5일
iijj = randperm(10,2)
ii = matrix(iijj(1),:)
jj = matrix(iijj(2),:)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!