RSVP : REPLACE LETTERS WITH DIGITS

1 view (last 30 days)
% CONDITION 1 = RSVP OF 13-21 LETTERS RANDOMLY WITHOUT REPLACEMENT
% CONDITION 2 = 2 OF THE LETTERS WERE REPLACED WITH DIGITS, RANDOMLY DRAWN
% CONDITION 3 = T2 IS PRESENTED 3 TO 6 TEMPORAL POSITIONS FROM THE END
% CONDITION 4 = T1 AND T2 VARIED FROM 1:5 ITEMS
I am trying to run psychtoolbox for my RSVP experiment. can someone please help me to program (replace) letter stream with T2 and T1 as required in condition 3 and condition 4.
s = ['A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'J' 'K' 'L' 'M' 'N' 'P' 'R' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z'];
str=datasample(s,1,'Replace', false);
nletters = [13:21];
ntrial = datasample(nletters,1);
T1 = randi([2,9], black);
T2 = randi([2,9], black);
l2 = datasample(nletter);
for index = 1:ntrial
str=datasample(s,1,'Replace', false)
T1 = strrep(s,
T2 = strrep(s,
end
  2 Comments
Guillaume
Guillaume on 22 Oct 2019
Your question is not clear. What's T1, what's T2, what does "T1 AND T2 VARIED FROM 1:5 ITEMS" mean? Please provide an example of what you want.
The code you've written doesn't make much sense, you're using some functions incorrectly and you're using undefined variables such as black and nletter.
Note that:
s = ['A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'J' 'K' 'L' 'M' 'N' 'P' 'R' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z'];
is exactly the same as the much simpler:
s = 'ABCDEFGHIJKLMNOPQRSTUVXYZ';
and could be generated with the even simpler:
s = 'A':'Z';
Migmar Tsering
Migmar Tsering on 22 Oct 2019
Hi Guillaume, thank you so much for helping me here. I am totally new to the programming world and your help is greatly appreciated.
I am trying to run rapid serial visual presentation (RSVP) paradigm experiment for attentional blink phenomenon. for the experiment,
1) 13 to 21 letters is randomly drawn (without replacement) from the alphabet (I, O, Q, and S are left out because they resemble digits).
2) on each trial, 2 of the letters were replaced with digits, randomly drawn (without replacement) from the digits 2 through 9.
3) the second digit (T2) was presented 3 to 6 temporal positions from the end of the stream. and the temporal distance between the first digit(T1) and the second digit(T2) is systematically varied from 1 to 5 positions.
thansk again for your help.

Sign in to comment.

Accepted Answer

Guillaume
Guillaume on 22 Oct 2019
s = 'A':'Z';
%condition 1
numletters = randi([13, 21]); %number of letters to select is a random number from 13 to 21 letters
rsvp = s(randperm(numel(s), radn)); %draw that number of letters randomly without replacements
%condition 2
digits = '0':'9';
replaceidx = randperm(numel(rsvp), 2); %select 2 different indices
replacement = digits(randi(numel(digits), 2)); %and two digits. If the two digits MUST be different use randperm instead of randi
rsvp(replaceidx) = replacement; %replace the letters at the two random indices by the random digits
As per my comment to your question, I have no idea what the other 2 conditions mean.
  3 Comments
Guillaume
Guillaume on 23 Oct 2019
allletters = 'A':'Z'; %whole alphabet
letterset = setdiff(allletters, 'IOQS'); %remove IOQS from set
digits = '2':'9';
%step 1. Draw 13 to 21 letters without replacement
numletters = randi([13, 21]); %number of letters to select is a random number from 13 to 21 letters
rsvp = letterset(randperm(numel(letterset), numletters)); %draw that number of letters randomly without replacements
%step 2. Select two different digits
replacements = digits(randperm(numel(digits), 2));
%step 3. Put one digit, 3 to 6 indices from the end, the other one 1 to 5 indices before that
positions = randi(numel(rsvp) - [6, 3]) - [randi(5), 0];
rsvp(positions) = replacements %do the replacement

Sign in to comment.

More Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!