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