How to extend this code?
Show older comments
I have attached a code below, which performs an operation. In the code below, i have done it with input as 8 digits. i want it with 128 digits. How can i use for loops and solve this issue?? for eg: here
x='11101101'
v='11001011'
Z='00000000'
But i want it for x=d9313225f88406e5a559......0000000 (128 digits each) {hexa decimal values}
x = '11101101';
v = '11001011';
Z = '00000000';
R = '10110111';
lsb=v(end);
w=xor(x-'0',v-'0');
movex = @(z,a) [zeros(1,a) z(1:end-a)];
q=movex(v,1);
if x(1,1)==0
Z1=Z;
else
w=xor(Z-'0',v-'0');
end
if lsb==0
v1 = movex(v,1);
else
%k= xor([q{:}]-'0',[R{:}]-'0');
k1=movex(v,1);
k = xor(k1-'0',R-'0');
end
What changes must I make, to make it easier, liking using loops??
Answers (0)
Categories
Find more on MATLAB 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!