Getting parity
Afficher commentaires plus anciens
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);
Réponses (2)
Paulo Silva
le 30 Juil 2011
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 commentaires
mahaveer hanuman
le 30 Juil 2011
Paulo Silva
le 30 Juil 2011
num = 100; source = randint(num,2);
parity = mod(source(:,1)+source(:,2),2)
Walter Roberson
le 30 Juil 2011
num = 100; source = randint(num,2);
parity = xor(source(:,1), source(:,2));
1 commentaire
mahaveer hanuman
le 31 Juil 2011
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!