フィルターのクリア

How to perform XOR on a char matrix?

1 回表示 (過去 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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by