I have three variables that I have made and i want to change the value of some of the elements. If the participant answered correct (1 in the third column) then i want to change their reaction time to be a random number with a mean and standard deviation of 1, squared with .3 added to it.
stimnum = randi([1 3], [1 100]);
rt = ((1 + 1.*randn(1, 100)).^2) + .1;
correct = rand(1,100)>0.2;
m = [stimnum; rt; correct ]';
I have written code that does this basically, but every time it replaces an element it puts in the same exact random number, i want matlab to pull up a new random number each time it replaces the rt element.
m(m(:,3)>.5, 2) = ((1 + 1.*randn).^2) + .3;
Aucun commentaire:
Enregistrer un commentaire