append data at the end of cellarray?
Afficher commentaires plus anciens
- fid = fopen('TEXTFILE.txt','r');
- tline = fgets(fid);
- while ischar(tline)
- words=regexp(tline,'<s>|\w*|</s>','match');
- * trigram=cellfun(@(x,y,z) [x ' ' y ' ' z],words(1:end-2), words(2:end-1),words(3:end),'un',0); *
- tline = fgets(fid);
- end
- fclose(fid);
- uniquetrigram = unique(trigram);
- counts = cellfun(@(x)sum(strcmp(x,trigram)), uniquetrigram);
- % Group them together
- trigramcount = [uniquetrigram.' num2cell(counts.')]';
QUERY: I have problem in line number "5" because every time i want to store the output at the end of "trigram" cell array but it is storing the out of last line only. Every time i want to append the output of "* cellfun(@(x,y,z) [x ' ' y ' ' z],words(1:end-2), words(2:end-1),words(3:end),'un',0); *" in to "trigram" how can i do this?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Software Development Tools dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!