Getting parity
显示 更早的评论
num = 100; source = randint(num,2); it is a 2x100
i should first row elements and j should be 2nd row elemntshow can i do it
parity = mod(source(i)+ source(j),2);
回答(2 个)
Paulo Silva
2011-7-30
code from your other question, fixed by me:
num = 100; source = randint(num,2);
r1 =source(1,:); r2 =source(2,:); parity = mod(r1+r2,2);
hope it's all correct
2 个评论
mahaveer hanuman
2011-7-30
Paulo Silva
2011-7-30
num = 100; source = randint(num,2);
parity = mod(source(:,1)+source(:,2),2)
Walter Roberson
2011-7-30
num = 100; source = randint(num,2);
parity = xor(source(:,1), source(:,2));
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!