DES implementation in MATLAB faacing error in performing XOR operation

3 views (last 30 days)
hello everyone can any one please help me out?
i am performing XOR operation in MATLAB for cryptography i am a student
XOR function that i need to call in MAIN DES :
function c=XOR(a,b)
error i get is :
Error using ~=
Matrix dimensions must agree.
Error in XOR (line 2)
please someone help me out. Thankyou

Answers (1)

Chris on 30 Oct 2022
Edited: Chris on 2 Nov 2022
a and b apparently do not have the same number of characters. You can confirm this by displaying their sizes:
The sizes should be equal. If you want to pad a char vector with empty space, use concatenation.
a = [a, ' ']; %add two spaces to a row vector
b = [b; [' ']']; %add two spaces to a column vector: transpose before concatenating


Find more on Encryption / Cryptography in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by