append data at the end of cellarray?
Show older comments
- 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?
Accepted Answer
More Answers (0)
Categories
Find more on Software Development Tools in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!