v = zeros(1,NToys);
NRolls = 0;
needs to be inside your Trial loop so that it resets for each trial.
A simpler way to create your w:
Your while loop condition is that if any v is not equal to its w counterpart, so
v~=w is a vector result and is not doing what you expect for the conditional test. Or you could have used:
And after your while loop is over, you need to remember the number of rolls it took for this trial. E.g.,
NRolls_trial(Trial) = Nrolls;
Then you can average them when it is all over.