0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 ntrials = 20;
0011 ncond = 4;
0012 total_trials = ncond*ntrials;
0013
0014
0015 fprintf('Creating design matrix with randperm ...\n');
0016 X = reshape(ones(ntrials,1)*(1:ncond),total_trials,1);
0017
0018
0019
0020 X = full(sparse(1:total_trials,X(randperm(total_trials)),1));
0021
0022
0023 X(:,ncond) = [];
0024
0025
0026 fprintf('Creating desing matrix with counter ...\n');
0027 [c] = counter(ncond, ntrials*ncond);
0028
0029 Y = full(sparse(1:total_trials,c,1));
0030 Y(:,ncond) = [];
0031
0032
0033
0034 fprintf('Correlation matrix generated using randperm:\n')
0035 corrcoef(X)
0036
0037 fprintf('\nCorrelation matrix generated using counter:\n')
0038 corrcoef(Y)