Contents

%function demo1()
%
% A demonstration file for the ICN/FIL Matlab course
%
% Usage: demo1.
%
% Author: Ashish Ranpura (2006)
%         a.ranpura@ucl.ac.uk
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

VARIABLE DECLARATIONS

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global COND;                        % used for EOG trigger (ar_triggers.m)
global cogent;                      % used for Cogent data structures (start_cogent.m)

datadir = '~/Desktop/ICN_demos/';   % full path to folder containing setup files
ntrials = 120;                      % must be an even multiple of 10
ISI = 1500;                         % inter-stimulus interval in milliseconds



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

EXPERIMENTAL SETUP

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ask for subject's name and the TMS condition code
name = upper(input('Subject initials: ','s'));
COND = input('Condition code (1-4): ');
fprintf('\n  read name=%s and cond =%g \n\n',name,COND)

% check the validity of the condition code
while (~ismember(COND,1:4))
    COND = input('Error! Please enter a condition code (1-4): ');
end
Error using ==> input
Cannot call INPUT from EVALC.

open input and output files

log_file = strcat(name, '_log.txt');
results_file = strcat(name, '_cond_', num2str(COND, '_res.txt');
fid_log = fopen(log_file, 'a');                  % append mode
fid_results = fopen(results_file,'a');               % append mode
fprintf(fid_results,'name: %s   condition: %1.0f\n',name,COND);
fprintf(fid_log,'name: %s   condition: %1.0f\n',name,COND);