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

1 次查看(过去 30 天)
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

回答(1 个)

dpb
dpb 2014-12-22
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');

类别

Help CenterFile Exchange 中查找有关 String Parsing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by