Strcmp Error

6 Ansichten (letzte 30 Tage)
Duch
Duch am 3 Feb. 2012
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 3 Feb. 2012
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.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by