Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
How can I see if a number in my vector is also present in a another vector while in the same place as the previous vector
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
So I have two random numbers ex. 18239 & 28491. I want to know how I can check to see if any digits in the first number apear in the second number in the same place. So my answer would result in 1 since only 1 number repeats in the same place (8). another example 12345 & 12376 answer would be 3 since digits 1, 2, 3 apear in the second number in the same place. My two numbers will never have repeating numbers in them so ex. 12399 will never be a number.
code = 95617
guess = 32617
dig_code = dec2base(code,10)-'0'
dig_guess = dec2base(guess,10)-'0'
this code will break up my number into digits in a vector this is what I am building off of.
0 commentaires
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!