I have a text file containing certain story that i want to read using Matlab. How can i do that?

1 view (last 30 days)
I have a text file containing
"In [7] genetic algorithm is combined with neural network for intrinsic plagiarism detection. Approach of [7] consists of two parts: document pre-processing and neural network evolution. During pre-processing several stylometric features such as Number of punctuation marks, Sentence length (number of characters), Sentence word frequency class, etc. are extracted and an average document wide value for each features are calculated."
I want to read that text file using Matlab. How can i do that??
Thanks

Answers (1)

dpb
dpb on 22 Dec 2014
Depends on what you want/need to do with it once you've read it...
As a cell array of strings, one cell/line
file = textread('filename.txt','%s','delimiter','\n','whitespace','');
As a cell array, one cell of size number of space-delimited words...
fid=fopen('filename.txt','r');
file=textscan(fid,'%s','collectoutput',true);
As a character image array...
fid=fopen('filename.txt','r');
file=fread(fid,[],'*char');

Tags

Community Treasure Hunt

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

Start Hunting!