MATLAB: How to pick randomly elements from a vector without repetation selectingvectors If I have a vector like this : a=[1 2 3 4 5] i know how to do this but my vector is something like: a=[23 46 4 2 5] I should pick 2 elements randomly without repetation. Best Answer a(randperm(length(a),2)) Related SolutionsMATLAB: Generating random number from a vector A(randi(numel(A)) MATLAB: Picking indices randomly idx1 = find(A==1);idxkeep = randperm(numel(idx1),how_many_you_want);idx12keep = idx1(idxkeep); Related QuestionHow to randomly select an element in a matrixPicking random points…How to sort a vector in a random manner in MATLABI have a vector A = [1 3 5 4 2]. I have a vector of the form B = [2 4 5]. How to check if all the values in vector B are in vector A
Best Answer