Attempted to access tfMatrix(0,1); index must be a positive integer or logical. Error in modellingPLSA (line 25) tfMatrix(w​ordNumber,​documentNu​mber) = tfMatrix(w​ordNumber,​documentNu​mber) + 1;

1 view (last 30 days)
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

Answers (0)

Categories

Find more on Text Data Preparation in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!