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

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.....

 채택된 답변

Dishant Arora
Dishant Arora 2014년 6월 23일
A(:,3:4)=~A(:,3:4)

댓글 수: 3

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2014년 6월 23일

댓글:

2014년 6월 23일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by