MATLAB: Selecting random number from martrix random number I have a matrix of 10rows and 10 columns,i want to select 5 rows randomly ,please help Best Answer one way to do it is row = randperm(10); row = row(1:5); result = your_matrix(row,:); Related SolutionsMATLAB: Select random number from a variable out = a(randperm(numel(a),4));orii = randperm(numel(a));out = a(ii(1:4)); MATLAB: How to select random rows from a matrix and delete it from the original matrix for another random selection. A=rand(100); % a random matrixn=10;. idx=randsample(1:size(A,1),n) ;B = A(idx,:) ; % pick rows randomly A(idx,:)=[]; % remove those rowsidx = randsample(1:size(A,1),n) ;C= A(idx,:); Related QuestionSelecting random numbers
Best Answer