0

I have a 35x2 matrix (randomwords); and I have randomly selected 8 rows (rndm). What I need to do is remove the 8 selected rows from the randomwords matrix and save this new 27x2 matrix under a new variable heading, but I am finding this extremely difficult. I have provided my code Any help would be greatly appreciated.

target = words ([30 1 46 14 44 55 8 3 57 65 69 70 57 39 21 60 22 20 16 10 9 17 62 19 25 41 49 53 36 6 42 58 40 56 63]);
synonym = words([43 15 32 28 72 27 48 51 13 67 59 33 35 47 52 61 71 7 23 12 2 66 11 37 4 45 64 38 34 31 29 18 50 68 26]);
% assigns these elements of words into targets and synonyms.  They are
% ordered so that words and synonyms are corresponding elements of
% synonyms and targets


% TO SELECT 8 RANDOM WORDS FOR THE ENCODING PHASE

randomwords = [target; synonym]';   % should be a 35x2 matrix
rndm = datasample(randomwords, 8, 1);    % should select 8 random couples from the rows and none of them will be repeats 
unpaired = rndm(:,2);     % should select only the synonyms to form the unpaired stimuli; will be different for each run
4

1 回答 1

1

将已删除行的索引存储在一个变量中,假设removedrows然后执行以下操作:

result = randomwords;

result(removedrows,:) = [];
于 2012-12-06T19:21:44.763 回答