MATLAB: Random integer numbers using random function MATLABrandirandom number generator Hi, I am trying to obtain 9 random integer numbers and want them to be appeared in this form expectedoutpt = '989898989' '897676767' any suggestion? Best Answer Something like:function ri = rnum() ri = num2str(randi([1,9],1,9)); ri = ri(~isspace(ri));end Related SolutionsMATLAB: Random x = [1 2 3 4 56 7 8 9 1011 12 13 14 1516 17 18 19 20];EDIT after Mohammad's coment[m,n] = size(x);df = bsxfun(@plus,fullfact(m*ones(1,n)),(0:n-1)*m);k = randperm(size(df,1));out = x(df(k(1:min(100,numel(k))),:));OR[m,n] = size(x);xc = mat2cell(x,m,ones(n,1));cc = cell(1,n);[cc{:}] = ndgrid(xc{:});k = randperm(numel(cc{1}));out = cell2mat(cellfun(@(x)x(k(1:min(100,numel(k)))'),cc,'un',0)); MATLAB: Random numbers help randdoc rand Related QuestionRandom number, Random integerRandom fun.Random numbers
Best Answer