OriginalMatrix = randn(1020,9);
RandomMatrixIndex = randperm(1020);
IndexFirstMatrix = RandomMatrixIndex(1:end/2);
IndexSecondMatrix = RandomMatrixIndex(end/2+1:end);
FirstMatrix = OriginalMatrix(IndexFirstMatrix,:);
IndexFound = ismember(OriginalMatrix,FirstMatrix,'rows');
EqualIndex = find(IndexFound==1);
FoundedIndexSecondMatrix = find(IndexFound==0);
Cmp1 = norm( sort(IndexFirstMatrix)-EqualIndex')
Cmp2 = norm( sort(IndexSecondMatrix)-FoundedIndexSecondMatrix')
Cmp1 =
0
Cmp2 =
0
1 Comment
KALYAN ACHARJYA (view profile)
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/490217-create-a-matrix-that-stores-rows-that-are-not-from-a-random-sample#comment_765645
Sign in to comment.