Effacer les filtres
Effacer les filtres

Read text file

3 vues (au cours des 30 derniers jours)
Charles
Charles le 7 Déc 2011
Hi,
I have a text file which contains the following data format
3
abc (1:200, 200: 400)
bcd (1:300, 200: 300)
cde (1:100, 200: 500)
The first line tells me the number of lines to read in. How do I read in the values of the 2: 4th lines? I am using textread but it only returns the value of the first line.
Thanks. Charles

Réponse acceptée

the cyclist
the cyclist le 7 Déc 2011
There are at least a couple ways you can try. One is to use the textscan() command.
I also like the readtext() command from the File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/10946 for this sort of thing.
  1 commentaire
Charles
Charles le 7 Déc 2011
textscan is exactly what I needed. Thanks.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Import and Export dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by