필터 지우기
필터 지우기

How to perform XOR on a char matrix?

조회 수: 3 (최근 30일)
Abirami
Abirami 2015년 4월 19일
편집: Abirami 2015년 4월 19일
Hello,
I have a 1x5 char matrix. I need to perform a bitwise XOR operation on all the elements in the matrix.If T is the char matrix , I need a matrix T' such that
T`= T XOR (T-1)` for all T
T for T=1
Let the char matrix be T
T=['0000000000110111' '0000000001000001' '0000000001001010' '0000000010111000' '0000000000101111']
T`=['0000000000110111' '0000000001110110' '0000000000111100' '0000000010000100' '0000000010101011']
ie; Leaving the first element as such , I need to XOR all the other elements with the newly formed matrix. I tried the following code but I'm unable to get the correct result.
Yxor1d = [T(1) cellfun(@(a,b) char((a ~= b) + '0'), T(2:end), T(1:end-1), 'UniformOutput', false)]
I need to perform the XOR operation such that , for obtaining the elements of T'
T' (2)= T(2) XOR T' (1) T' (3)= T(3) XOR T' (2) and so on.
It'll be really helpful to know where I went wrong.Thanks in adavnce. Please help.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by