Find a value in a vector
Afficher commentaires plus anciens
Hello, I need some help.
I want to search in this vector s=[25 33 56 25 98 25 33 25 33 25 68 25 98], for this value, Pattern=25, and I want to memorize in a variable what numbers are repeated after this Pattern I choose and the one that is repeated most of the time to keep it in a variable FinalPrediction.
Pattern=25 => What is up next after Pattern :numbers.repeated= 33,98,33,33,68,98 => Results that number 33 is repeating 3 times after Pattern=25 That means my next number after the last number from s vector is number 33 .
>>FinalPrediction=33
>> s.final = [25 33 56 25 98 25 33 25 33 25 68 25 98, 33 ]
I don't now how to write a cod that gives to me this result
Thank you!
Réponse acceptée
Plus de réponses (1)
Sulaymon Eshkabilov
le 6 Juin 2021
V = [ .......] %
Most_V = mode(V);
VFinal = [V, mode(V)];
Catégories
En savoir plus sur Creating and Concatenating Matrices 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!