MATLAB Answers

0

how to replace elements of a matrix position wise?????

Asked by suchismita on 23 Jun 2014
Latest activity Commented on by suchismita on 23 Jun 2014
I have a matrix: A=[1 1 0 1; 1 0 1 1; 1 0 0 0; 0 1 0 1] now the elements of 3rd and 4th column i want to change every element as if its 1 than 0 or if its 0 than 1.
please please help me.....

  0 Comments

Sign in to comment.

1 Answer

Answer by Dishant Arora on 23 Jun 2014
 Accepted Answer

A(:,3:4)=~A(:,3:4)

  3 Comments

thank u....if instead of 3 and i want to change of 1 and 4
A(:,[1,4]) = ~A(:,[1,4])
thank you so much

Sign in to comment.