Trying to use fscanf and nested for loops

3 visualizaciones (últimos 30 días)
Ian Barker
Ian Barker el 8 de Mzo. de 2013
So i have an assignment due in a few hours. I'm supposed to extract hurricane data from a text file, turn it into a matrix and then get some of the data out of it.
The last part would be easy enough but I can't figure out how to correctly use fscanf inside of a for loop. I've taken a look at the documentation and done some trial and error for about an hour and gotten nowhere. I can't get fscanf to give me individual columns of the data set, instead it just spits out either the whole thing or an error message.
BTW the data looks like this, split up by year, ACE number, and number of tropical storms.
2001 106 15
2002 65 12
2003 175 16
2004 225 14
2005 248 28
2006 79 10
2007 72 15
2008 145 16
2009 51 9
2010 62 7
  2 comentarios
Cedric
Cedric el 8 de Mzo. de 2013
Editada: Cedric el 8 de Mzo. de 2013
If you don't know how to proceed with FSCANF, read the doc of FILEREAD and STR2NUM.
>> doc fileread
>> doc num2str
If you want to do it using FSCANF, please post your current code so we can discuss it.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre String Parsing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by