A = reshape(A(~arrayfun(@isequal, A, -ones(size(A)))),size(A,1),);
It first finds a logical array of vectors that are equal to-1 usingarrayfun, takes the values of the matrix that are not those values and creates a new vector from them. It then takes that vector and reshapes it to the row size of the original matrix to create the new‘A’ matrix.
My goal is to remove the columns that entirely contain the value -1. the problem is more general, I have a matrix A: size m * n with m number of test samples and n is the label of the class . The size of A in my case is 1000 * 1181. I want to remove the column and also their index.