Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- how I can eliminate in a matrix all columns whose last two elements are equal? in Matlab
- A=[1 2 3 ; 4 5 6 ; 5 5 5]
- A =
- 1 2 3
- 4 5 6
- 5 5 5
- A(:,A(end,:)==A(end-1,:))=[]
- A =
- 1 3
- 4 6
- 5 5
- index = (A(:,end) == A(:,end-1) );
- A(:,index) = [];
- B = A( : , A(: , end-1) ~= A(: , end) )
Add Comment
Please, Sign In to add comment