read txt. file

i, please, i want send txt file ,then can one read it and place it in an array (each row consist of 4 elements) the problem that file contains digits and letters.
I can not write it correctly, each time different problem is appearing.
how I can send txt file?
thanks in advance
I want to add the following if my file contains names and digits as:
1800275327 Ashes of Time (1994) 757
1804018992 Jar, The (Khomreh) (1992) 758
1800262502 Maya Lin: A Strong Clear Vision (1994) 759
1800263541 Stalingrad (1993) 760
1800261005 Phantom, The (1996) 761
1800260807 Striptease (1996) 762
I got it by getl, what I need : ex. from first row ,the first element 1800275327 and the third 757 and left the second. how get an array contains just two elements?
thanks

4 Comments

Robert Cumming
Robert Cumming on 11 Oct 2011
what have you tried?
Fangjun Jiang
Fangjun Jiang on 11 Oct 2011
You've been on the forum long enough to learn to use markup/format when posting question.
huda nawaf
huda nawaf on 11 Oct 2011
simply,I want to read this file and place these data in an array
huda nawaf
huda nawaf on 11 Oct 2011
how read this file into array:
this is sample of (txt.file):
1800275327 Ashes of Time (1994) 757
1804018992 Jar, The (Khomreh) (1992) 758
1800262502 Maya Lin: A Strong Clear Vision (1994) 759
1800263541 Stalingrad (1993) 760
1800261005 Phantom, The (1996) 761
1800260807 Striptease (1996) 762

Sign in to comment.

 Accepted Answer

osman
osman on 11 Oct 2011

0 votes

use textscan

3 Comments

huda nawaf
huda nawaf on 11 Oct 2011
thanks, it is good
but when the number of columns are not equal , how solve that?
ex.
1800247298 Toy Story (1995) 1
1800022746 Jumanji (1995) 2
the first row has three strings %s%s%s
and the second has two %s%s.
huda nawaf
huda nawaf on 11 Oct 2011
please,
how get from this file just digits and ignore string?
i.e for example
from first row , i need just 1800247298 and 1
and so for the other rows
thanks
huda nawaf
huda nawaf on 12 Oct 2011
thanks,
textscan is useful for me.
but , how can get second column or third,...?
I can just display first column by
names = textscan(fid,'%s%*[^\n]');
thanks

Sign in to comment.

More Answers (0)

Tags

Asked:

on 11 Oct 2011

Community Treasure Hunt

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

Start Hunting!