Creating Dummy Variables Using MATLAB

 

(1, 2, 3 . . . 2394) x 144 Times (344736 cases) as When Creating LORETA Voxel-Number Variable

>> a = 1:2394; {a is matrix}
>> size(a)

ans =

           1        2394

>> a = a'; {transposes row to vector}
>> a = repmat(a,[144,1]); {replicate vector 144 times}
>> size(a)

ans =

      344736           1

>> dlmwrite('VoxelNumber.txt',a) {writes delimited file}

 

Same But in Steps of 2 (e.g., 1, 3, 5 . . .)

a = 1:2:2394;

 

(1 2394-times, 2 2394-times . . .144 2394-times) as When Creating Frequency Bin Variable

a = zeros(0) {a is 0x0 matrix of zeroes}
for i = 1:144 {run a loop 144 times with counter as "i"}
   a = [a; i*ones(2394,1)]; {first loop, 2394 values of 1; 2nd loop, 2394 values of 2, etc. till 144 loops}
end

dlmwrite('bin_number.txt',a) {writes delimited file}

 

 

ERP Peak Extraction

Click here