Project

General

Profile

Tasks #136 » readExperimentConfig.m

Eydís Huld Magnúsdóttir, 2013-03-06 22:37

 
% function readExperimentConfig(fname)

fname='Experiment_config.txt'
fid=fopen(fname);
if fid==-1
error(['Cannot open file ' fname])
end;

while ~feof(fid)
fline=fgetl(fid);
if isempty(fline)
continue;
end
if strcmp(fline(1),'#')
continue;
end;
itemname=fline(1:find(fline=='=')-1); itemname(itemname==' ')=[];
itemvalue=fline(find(fline=='=')+1:end);itemvalue(itemvalue==' ')=[];
switch upper(itemname)
case 'NAME'
Name=itemvalue;
case 'IDNUMBER'
IDnumber=itemvalue;
case 'AGE'
Age=itemvalue;
case 'GENDER'
Gender=itemvalue;
case 'OTHER'
Other=itemvalue;
case 'NUMLINES'
numLines=itemvalue;
case 'NUMWORDS'
expPar.numWords=itemvalue;
case 'EXPPAR.COLOURS'
expPar.colors=itemvalue;
case 'EXPPAR.CNAMES'
expPar.cnames=itemvalue;
case 'EXPPAR.FH'
expPar.fh=itemvalue;
case 'EXPPAR.PAUSETIME'
expPar.pausetime=itemvalue;
case 'EXPPAR.NUMVISABLE'
expPar.numVisable=itemvalue;
case 'EXP_BLACK'
expPar_black=itemvalue;
case 'EXPPAR_BLACK.COLORS'
expPar_black.colors=itemvalue;
case 'FS'
fs=itemvalue;
case 'NMBITS'
nbits=itemvalue;
case 'NCHANNEL'
nchannel=itemvalue;
end
end;
fclose(fid);
(1-1/2)