MATLAB: Sort two matrix sort hi i have two matrix X,Y (same size) i want to sort X and the same time i want to take the matrix Y with the same changes as X example: X=[4,7,1,9] Y=[32,6,4,21] after sort X=[9,7,4,1] Y=[21,6,32,4] thanks for your time!!!! Best Answer [X,index]=sort(X,'descend')Y=Y(index) Related SolutionsMATLAB: How to find y axis value’s opposite x axis value If both vectors are of same size, find the index of your variable from y and use it to pick the value at that position in x. A simple example is x = [1 2 3 4]; y = [5 6 7 8]; ind = find(y==7); x(ind); MATLAB: How to “partner” 2 matrixes X = [4 7 1 9; 3 0 6 8] Y = [32 6 4 21; 77 89 0 2]newX = [3 9 4 6; 1 7 8 0][found, where] = ismember(newX, X);assert(all(found(:)), 'some elements of newX are not present in X')newY = Y(where) Related QuestionSubtraction for Matrix of Different LengthKeep only one set-cordinate (x,y) per x.How to use conditional statement for this caseCreation of multiple rectanglesReverse matrix positionAdding data to two matrices for indexingHow to solve the two equations numerically in which tabular data is also to be loaded
Best Answer