How to select Text sentences from original document that are split and numbered in Matlab? -



How to select Text sentences from original document that are split and numbered in Matlab? -

i have text document, split text document separate sentences after total stop , displayed them, code used follows:

sentences = regexp(f,'\s.*?[\.\!\?]','match') char(sentences)

now did processing , got selected number of sentences in form of number 1,2,3,4,...n stored in 1d cell arrays follows:

output= out{1}= 1,2 out{2}= 2, 4 out{n}= n..

these 1,2,4 sentence numbers, want select , display sentence # 1,2 , 4 sentences suppose have 10 sentences output should 3 sentences now.

there many ways select , display indexed sentences. instance:

1- for loop

for = 1:numel(out{1}) fprintf('%s\n', sentences{out{1}}); end

2- in 1 line, cellfun:

cellfun(@(x) fprintf('%s\n',x), sentences(out{1}));

best,

matlab

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -