MATLAB: How to select random numbers from array for creating new matrix random I have b1 array. b1=[-3,-1,1,3,5]; I want to create 3×4 matrix by using random elements of b1 array. So, one of expected outputs: ans= -1 5 -3 1 1 -3 5 -3 3 5 1 3 Anyone can help? Best Answer Hi,try:b1=[-3,-1,1,3,5];A = b1(randi(numel(b1),3,4))possible result:A = 1 -1 -3 3 -3 5 -3 3 -1 -3 3 1Best regardsStephan Related SolutionsMATLAB: Repeat a matrix in defined manner A=[1 2 3;4 5 6;4 5 6];m=4B=cell2mat(arrayfun(@(x) x*ones(1,m),A,'un',0)) MATLAB: Covariance Matrix Hint 1: randn() returns a normally distributed random number with mean 0.Hint 2: A + i*B Related QuestionSelect elements of MatrixHow to genneral a repeat arrayHow can enlarge a matrixHow to order a matrix
Best Answer