IIvana,
Without any promises that they will help you, I forward two scripts I
use to extract stimulus onset times from eprime files. Since Eprime
now writes 16-bit txt files, the first script converts them to 8-bit
so that I can then use the unix grep command on them in the second
script.
Very Best!
Jim Lee
Univ. of Utah
% Script to re-write eprime text files so they are 8 bit style
% Filename
file3 = 'VisualOddballDots-1-1.txt';
fid = fopen(file3, 'r');
uni=fread(fid,'uint16');
fclose(fid);
eval( ['!rm -rf ' file3]);
fid2 = fopen(file3, 'w');
fwrite(fid2,uni,'uint8');
fclose(fid2);
SECOND INDEPENDENT SCRIPT
% script to read the eprime txt file and get results for visualoddball
%
% directions: copy to subjects eprime directory, matlab -nojvm, type visodd
% note: need to convert to 16bit first using /users/jim/eprime/rewrite_one.m
% then, in the matlab window, use:
% disp(sprintf('%7.3f ',std_time));
% to print out the string for std_time and dev_time,
% or save to .mat files to use during processing - load into matlab
% after start spm, then type array name for condition onsets
%
% The offset of 2000 ms accounts for a 2 second fixation in the task
% before any circles appear
%
% The circles are chosen by random selection, so BE SURE that
std_strings(1)
% is lower than dev_strings (1), since all others are referenced to it
%
% Standard circles
!grep StandardStimulus.OnsetTime VisualOddballDots-1-1.txt > standard
[dummy, std_strings]=textread('standard','%s %s');
for i=1:length(std_strings)
std_time(i) = 2000 + str2num(std_strings{i}) - str2num(std_strings{1});
std_time(i) = std_time(i) / 1000;
end
% Deviant circles
!grep DeviantStimulus.OnsetTime VisualOddballDots-1-1.txt > deviant
[dummy, dev_strings]=textread('deviant','%s %s');
for i=1:length(dev_strings)
dev_time(i) = 2000 + str2num(dev_strings{i}) - str2num(std_strings{1});
dev_time(i) = dev_time(i) / 1000;
end
% Save arrays as .mat file
save std_time std_time;
save dev_time dev_time;
On 7/16/14, Ilvana Dzafic <[log in to unmask]> wrote:
> Hi,
>
> I have an fMRI experiment running on e-prime, the stimulus onset times, RT's
> etc are all recorded in a .txt file. Does anyone have a matlab script which
> is able to extract the onset times from the .txt file so that I can easily
> insert these into SPM for first level analysis?
>
> Thank you,
> Ilvana
>
> Ms Ilvana Dzafic
> PhD student | Queensland Brain Institute | University of Queensland |
> Brisbane Queensland 4072 | AUSTRALIA
>
> M: 0425 540 692 | P: 3346 3340 | E: [log in to unmask]
> <mailto:[log in to unmask]>
> W: http://www.qbi.uq.edu.au<http://www.qbi.uq.edu.au/>
>
> [qbi]
>
>
|