MATLAB: Find repeated columns of a matrix MATLABmatrix manipulation Hello, Consider a 8×100 matrix. It consists of 5 8×1 columns that are repeated randomly, namely the col1,…,col5. How can I find the indexes of the columns that contain the col1? Thank you. Pavlos Best Answer A=repmat(rand(8,5),1,100/5)A=A(:,randperm(100)) % your matrixcol1=A(:,1)idx=find(~any(bsxfun(@minus, A,col1))) Related SolutionsMATLAB: Comparing columns and returning 0s for matching values is it a table that you have or an array? Have you looked into ismember to see if this does what you want?doc ismember MATLAB: How to find the elements in an array that the summation of the elements equals to certain value Are you looking for something like thisA=[ 0 21; 21 3; 0 4; 7 3; 10 2; 0 5];idx_col1 = find(A(:,1));uni_col1 = A(idx_col1, 1);edges = [0; cumsum(uni_col1)];sum_col2 = cumsum(A(:,2));A(:,3) = idx_col1(discretize(sum_col2-1, edges)); Related QuestionHow to find a spesific value in a matrixFind the first column of a 3×3 matrixHow to combine multiple columns into arrayI need to divide two matrix with different rows and columnNeed help. I have extract a specific column from file and it contains zeros. How to remove those zero so it can match the vector and can be plotted?Repeated values in a column of a matrix
Best Answer