MATLAB: I have two number i want choose one of them randomly! chooserandomlystring i have two string number i want choose one of them randomly can you help me please? Best Answer str={'10' '20'}idx=randi(2)out=str(idx) Related SolutionsMATLAB: Generating random numbers without repitiion Nmin+rand(1,10)*(Nmax-Nmin) MATLAB: Choose elements from array randomly You must be using an older version of MATLAB, do this instead: % create vector a = randn(100,1); % determine how many elements is ten percent numelements = round(0.1*length(a)); % get the randomly-selected indices indices = randperm(length(a)); indices = indices(1:numelements); % choose the subset of a you want b = a(indices); Related QuestionRandom numbersHow can i generate real random numbersHow to generate same set of random numbersChoose randomly between two functionsGenerate real random numbersHow to choose randomly value from cell
Best Answer