how read this txtfile?

1 次查看(过去 30 天)
huda nawaf
huda nawaf 2012-7-21
hi,
if i have txt file with different types of values. how i can read it
the file has these information: 1|Toy Story (1995)|01-Jan-1995||http://us.imdb.com/M/title-exact?Toy%20Story%20(1995)|0|0|0|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0
2|GoldenEye (1995)|01-Jan-1995||http://us.imdb.com/M/title-exact?GoldenEye%20(1995)|0|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0
what i need is just access to last 19 items .i.e i need access to binary no.
how can do that?

采纳的回答

per isakson
per isakson 2012-7-21
编辑:per isakson 2012-7-21
This is a start. Add a loop and fgetl.
str = '1|Toy Story (1995)|01-Jan-1995||http://us.imdb.com/M/title-exact?Toy%20Story%20(1995)|0|0|0|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0';
cac = regexp( str, '(\|(1|0)){3,}', 'match' ) ;
tmp = cac{:}(2:end); % strip off first bar
val = textscan( tmp, '%u', 'Delimiter', '|', 'CollectOutput', true );
/R2012a

更多回答(0 个)

类别

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