Attempted to access tfMatrix(0,1); index must be a positive integer or logical. Error in modellingPLSA (line 25) tfMatrix(wordNumber,documentNumber) = tfMatrix(wordNumber,documentNumber) + 1;
1 次查看(过去 30 天)
显示 更早的评论
data = dlmread('fichier.txt','\t');
[m,n] = size(data);
doc_length = 4;
documents = floor((44*60+12)/doc_length);
windowSize = 20;
words = (280/windowSize+1)*(360/windowSize)*5*2;
FramesForWords = cell(words,documents);
for i=1:words
for j=1:documents
FramesForWords{i}{j} = [];
end
end
tfMatrix = zeros(words,documents);
for row=1:size(data,1)
i = data(row,1);
j = data(row,2);
frame = data(row,3);
opticalFlow = data(row,4);
blobSize = data(row,5);
documentNumber = uint16(floor(frame/(25*doc_length)))+1;
wordNumber = ((i/windowSize)*18+(j/windowSize))*10 + opticalFlow*2 + blobSize + 1;
tfMatrix(wordNumber,documentNumber) = tfMatrix(wordNumber,documentNumber) + 1;
FramesForWords{wordNumber}{documentNumber} = [FramesForWords{wordNumber}{documentNumber};frame];
if documentNumber == documents
break
end
end
1 个评论
Walter Roberson
2015-11-29
As we do not have the data from the file, we have no reason to expect that wordNumber will come out as a positive integer.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Data Preparation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!