Quit the task when the number of correct trials in each condition reaches a certain value November 13, 2023 01:59PM | Registered: 2 years ago Posts: 15 |
function [C,timingfile,userdefined_trialholder] = onlyFlash_userloop(MLConfig,TrialRecord) C = []; timingfile = 'onlyFlash.m'; userdefined_trialholder = ''; persistent timing_filenames_retrieved if isempty(timing_filenames_retrieved) timing_filenames_retrieved = true; return end persistent conditions locs = [9.6, 0; -9.6, 0]; if isempty(conditions) ind_all = [1 2; 2 1]; num_rep = 20; all_comb = repmat(ind_all, num_rep, 1); conditions = all_comb(randperm(size(all_comb,1)),:); end if isempty(TrialRecord.TrialErrors) % Start at block 1, trial 1 trial_nb = 1; else trial_nb = TrialRecord.CurrentCondition + 1; % Linear incrementation of the trial until all of the trials of the current block have been done if TrialRecord.TrialErrors(end) ~= 0 % If the subject made an error, the same trial is repeated conditions = [conditions;conditions(TrialRecord.CurrentCondition,:)]; elseif TrialRecord.CurrentCondition == length(conditions) TrialRecord.NextBlock = -1; timingfile = ''; C = []; return end end target_num = conditions(trial_nb,1); distractor_num = conditions(trial_nb,2); C = {'crc(0.3, [1 1 1], 1, 0, 0)',... ['crc(1, [1 1 1], 0, ' num2str(locs(target_num,1)) ',' num2str(locs(target_num,2)), ')'],... ['crc(1, [1 0 0], 0, ' num2str(locs(target_num,1)) ',' num2str(locs(target_num,2)), ')'],... ['crc(1, [1 1 1], 0, ' num2str(locs(distractor_num,1)) ',' num2str(locs(distractor_num,2)), ')'],... 'mov(central.mp4,0,0,1)'}; TrialRecord.User.flash_object = target_num; TrialRecord.NextCondition = trial_nb; end
Re: Quit the task when the number of correct trials in each condition reaches a certain value November 14, 2023 02:47PM | Admin Registered: 5 years ago Posts: 931 |
tbl = tabulate(conditions(find(0==TrialRecord.TrialErrors),1))
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.