Welcome! Log In Create A New Profile

Advanced

Problem with DRST code

Posted by jbergman 
Problem with DRST code
December 20, 2021 06:18PM
I am having a problem with a Delayed recognition span test possibly related to stacking scenes. Particularly with a concurrent scene. Any assistance would be appreciated. I'll attach the code but I am clipping the main loop to annotate the parts that fail or fail after the 4 th loop. I have been reading code for 40 years but not much experience with Matlab. Thanks.
Current software Matlab 2021, ML 2.2 Nov 21



------Snip------- Lines with Arrows are problems noted. They are not in the code
for i = 2 : numIters-1

if fixCells{i}.Success
if fixCells{i}.ChosenTarget == i

%goodmonkey(2000, 'juiceline',1, 'numreward',1, 'pausetime',0, 'eventmarker',50);
%Play correct Sound
con1 = Concurrent(tc_Correct);
con1.add(BoxCells{i});
scene = create_scene(con1);
>>>> run_scene(scene); >>>> No reward no Sound
idle(0); %test for sound
goodmonkey(2000, 'juiceline',1, 'numreward',1, 'pausetime',0, 'eventmarker',50);
idle(2000); %inter trial interval
scene2 = create_scene(tc_newScene);
>>>> run_scene(scene2); >>>> Runs correctly 3 times IE new box presentation has a sound
%idle(500);
scene3 = create_scene(fixCells{i+1});
run_scene(scene3);
else
trialerror(6); % wrong
>>>> scene = create_scene(tc_Incorrect); >>>> works correctly
run_scene(scene);
idle(700, [0 1 0]);
return;
end
else
trialerror(3); % Didn't touch any
scene = create_scene(tc_Incorrect);
run_scene(scene);
idle(700, [0 1 0]);
return;
end

end

if fixCells{numIters}.Success
if fixCells{numIters}.ChosenTarget == numIters
% goodmonkey(2000, 'juiceline',1, 'numreward',1, 'pausetime',0, 'eventmarker',50);
scene = create_scene(tc_Correct);
run_scene(scene);
goodmonkey(2000, 'juiceline',1, 'numreward',1, 'pausetime',0, 'eventmarker',50);
idle(0);
trialerror(0); %No Error in any one
return
else
trialerror(6); % wrong
scene = create_scene(tc_Incorrect);
run_scene(scene);
idle(700, [0 1 0]);
return;
end
else
trialerror(3); % Didn't touch any
scene = create_scene(tc_Incorrect);
run_scene(scene);
idle(700, [0 1 0]);
return;
end
Attachments:
open | download - drst.m (6.4 KB)
Re: Problem with DRST code
December 20, 2021 11:45PM
The task is working as you programmed. AudioSound does not rewind the wav automatically. To play it again, you should create the object again or rewind the wav with the PlaybackPosition property before calling create_scene().
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#AudioSound

Another thing you should know about the scene framework is that stimuli are presented until the next scene (or idle) starts. Keep this in mind when you try to find out why one sound plays to the end and the others do not.
Re: Problem with DRST code
December 21, 2021 06:26PM
Resetting the audio file worked well. One file was very short and must have gone EOF. The other .wav file performed as you described. Odd to have an EOF stimuli not reset when recalled but resetting was the answer. Thank you more than you can imagine.
Thanks
Re: Problem with DRST code
December 22, 2021 01:01PM
There is always a case that you don't want to repeat the sound no matter how short it is. Maybe I can add an option for automatic rewinding.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.