Strcmp Error

조회 수: 6 (최근 30일)
Duch
Duch 2012년 2월 3일
I am getting the following error:
Error using ==> strcmp
Not enough input arguments.
Error in ==> EFT at 150
if sum(strcmp(n.subject,subNames))
Here is the section of code:
numSubjects = 0;
allSubjects = cell(round(numFiles/4),1);
subNames = cell(round(numFiles/4),1);
maxNumStims = 0;
header('Reading Gaze Data',numFiles);
for i = 1:numFiles
rem = numFiles-i;
fileName=Q(i).name;
fileDate=Q(i).date;
walltime=str2num(fileDate(end-1:end)) + ...
60*str2num(fileDate(end-4:end-3)) + ...
60*60*str2num(fileDate(end-7:end-6));
theFile=[pathh fileName];
gd = readGazeData(theFile,numHeaderLines,cols);
gd.walltime = walltime;
gd.requireBothEyes = requireBothEyes;
allGazeData{i} = gd;
pat = 'B(?<block>\d) (?<type>[A-Z][A-Z]).+(?<subject>\d\d\d\d[.]\d\d)';
n = regexp(Q(i).name, pat, 'names');
blockNum = str2num(n.block);
allGazeData{i}.blockNum = blockNum;
if sum(strcmp(n.subject,subNames))
ind = find(strcmp(n.subject,subNames));
Does anyone know why I am getting this error? Thank you

채택된 답변

Walter Roberson
Walter Roberson 2012년 2월 3일
Please consider the possibility that
n = regexp(Q(i).name, pat, 'names');
might return empty.
You are running the regexp() against what looks like a file name rather than against (say) the gaze data.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by