MATLAB: How to change a vector from [5 3 2 5 5 4 1 2] to [1 3 4 1 1 2 5 4] switching the scale from 1-5 to 5-1 MATLABvectors Matlab textbook problem 2.33 Best Answer x = [5 3 2 5 5 4 1 2];y = 6 - x; Related SolutionsMATLAB: From a=[1 2 3 4] to b=[1 1 2 2 3 3 4 4] b = repelem(a,2) MATLAB: How to create this matrix [1 2 3 4 5;2 2 3 4 5;3 3 3 4 5;4 4 4 4 5;5 5 5 5 5] % datan = 7 % "order"% enginex = repmat(1:n,n,1) x = max(x, x.')Added after comment: for non-square matrices: n = 4 ; m = 6 ; % n-by-m matrix x = max(repmat(1:m,n,1), repmat(1:n,m,1).') Related QuestionPutting the combinations of a sequence in an cell arraySum columns of matrixGiven a=[1 2 3 4 5], generate m=[2 1 3 4 5; 2 3 1 4 5; 2 3 4 1 5; 2 3 4 5 1; 1 3 2 4 5; 1 3 4 2 5; 1 3 4 5 2; 1 2 4 3 5; 1 2 4 5 3; 1 2 3 5 4].
Best Answer