append data at the end of cellarray?
이전 댓글 표시
- 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?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Software Development Tools에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!