Error using bitxor Matrix dimensions must agree. key1=bitxor(a,b);and key=imresize(key1,[1 256])
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Praveen kumar
am 11 Mär. 2016
Bearbeitet: Walter Roberson
am 12 Mär. 2016
%key generation
a=uint16(dec2bin(sud1));
b=uint16(dec2bin(sud2,8));
key1=bitxor(a,b);
key=imresize(key1,[1 256])
1 Kommentar
Akzeptierte Antwort
Roger Stafford
am 11 Mär. 2016
Bearbeitet: Roger Stafford
am 11 Mär. 2016
As you have written the code, the numbers of elements in 'a' and in 'b' depend on how many bits are required to represent 'sud1' and 'sud2', respectively. It is very easy for these to be different, in which case 'bitxor' would give you an error. You need to use the form 'dec2bin(d,n)' for both quantities in which n is the same in both and large enough to guarantee that there will be exactly n bits in each string. For example, if sud1 = 1234 and sud2 = 12345, then n = 14 would cause both strings to have 14 bits, (even though 'a' would have 3 leading zeros beyond the minimum 11 it needs.)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Entering Commands finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!