I need to delete any column in a matrix with the same values ββin it. I developed it using for-loop in MATLAB. I wanted to know if there is a better / faster way to use vectorization.
mat = [ 0.56 0.2 1 0 45; 0.566 0.2 4 0 45; 0.52 0.2 6 0 45; 0.56 0.2 6 0 41 ]; [row col] = size(mat) ; bitmat = true(1,col) ; for i = 2:row, tf = (mat(i-1,:) == mat(i,:)) ; bitmat = bitmat & tf ; end mat(:,bitmat) = [] ;
Thanks!
Maddy source share