Converting Upper triangle to lower triangle

Hello all, I have a small point that stopping me in some ideas. It is about how to convert the binary lower triangle to xor upper triangular. For example: A = tril(randerr(4,4)); and then get A. I want the upper triangle = xor of A or we can say as conjugate A. The result if we XORed the Upper to Lower we get the zeros or ones.

댓글 수: 3

Geoff Hayes
Geoff Hayes 2015년 2월 2일
Abe - please clarify with an example what it is that you are looking for. If you have some zeros and ones in the lower triangular part of the matrix, how is the upper triangular part of the matrix related to it? If you xor the lower part with the upper part, what do you expect to see? All zeros or all ones or something else?
Abe
Abe 2015년 2월 3일
Thank you for looking here, any way I am sorry I think I did not clarify my question very well. As you said if have lower triangle ones and zeros, what I want to know how the upper triangle be lower triangle? For example:
A = [ 0 0 0 0 1 0 0 0 0 1 0 0 1 0 1 1] then B should equal [0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 1]
Again, I am sorry for misunderstanding
Abe
Abe 2015년 2월 3일
The above matrix 4x4 I missed the semicolon.

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

 채택된 답변

Youssef  Khmou
Youssef Khmou 2015년 2월 2일

0 개 추천

If the question consists of converting lower triangular binary matrix into upper triangular one, then is it possible to use logical operation xor, there are two possible values in a={1,0}, the kernel is b=1, so xor(a=1,b)=0 and xor(a=0,b)=1.
n=10;
A=ones(n);
A=tril(A);
B=xor(A,ones(n));
diagonal elements can be adjusted with options of tril function.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

Abe
2015년 2월 1일

댓글:

Abe
2015년 2월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by