How to extend this code?

6 Ansichten (letzte 30 Tage)
Darsana P M
Darsana P M am 12 Feb. 2018
Bearbeitet: per isakson am 12 Feb. 2018
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??

Antworten (0)

Kategorien

Mehr zu MATLAB 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!

Translated by