Can rectangularized data be achieved by modifying a text file with MATLAB?
Afficher commentaires plus anciens
I have a space delimited text file with the following contents:
NFL58 23Mar2012 Show 2 1 01 0000000001 Low
001 25.187466 156.162447 21578.188 97.134234 stops AAAAA 1 A10A
21600.123 21612.122
3100.435 4100.380 5100.739
-0.491736 1.491492 0.891808
0.051748 -0.071254 0.021175
1.100000e-01 1.200000e-01 1.300000e-01 1.400000e-01 1.500000e-01 1.600000e-01 1.700000e-01 1.800000e-01 1.900000e-01
2.100000e-01 2.200000e-01 2.300000e-01 2.400000e-01 2.500000e-01 2.600000e-01 2.700000e-01 2.800000e-01 2.900000e-01
3.100000e-01 3.200000e-01 3.300000e-01 3.400000e-01 3.500000e-01 3.600000e-01 3.700000e-01 3.800000e-01 3.900000e-01
4.100000e-01 4.200000e-01 4.300000e-01 4.400000e-01 4.500000e-01 4.600000e-01 4.700000e-01 4.800000e-01 4.900000e-01
5.100000e-01 5.200000e-01 5.300000e-01 5.400000e-01 5.500000e-01 5.600000e-01 5.700000e-01 5.800000e-01 5.900000e-01
6.100000e-01 6.200000e-01 6.300000e-01 6.400000e-01 6.500000e-01 6.600000e-01 6.700000e-01 6.800000e-01 6.900000e-01
7.100000e-01 7.200000e-01 7.300000e-01 7.400000e-01 7.500000e-01 7.600000e-01 7.700000e-01 7.800000e-01 7.900000e-01
8.100000e-01 8.200000e-01 8.300000e-01 8.400000e-01 8.500000e-01 8.600000e-01 8.700000e-01 8.800000e-01 8.900000e-01
9.100000e-01 9.200000e-01 9.300000e-01 9.400000e-01 9.500000e-01 9.600000e-01 9.700000e-01 9.800000e-01 9.900000e-01
002 25.287466 156.162447 21578.288 97.234234 stop BBBBB 2 A10B
21600.223 21612.222
3200.435 4200.380 5200.739
-0.492736 1.492492 0.892180
0.052748 -0.072254 0.022175
1.120000e-01 1.200000e-01 1.300000e-01 1.400000e-01 1.500000e-01 1.600000e-01 1.700000e-01 1.800000e-01 1.900000e-01
2.120000e-01 2.200000e-01 2.300000e-01 2.400000e-01 2.500000e-01 2.600000e-01 2.700000e-01 2.800000e-01 2.900000e-01
3.120000e-01 3.200000e-01 3.300000e-01 3.400000e-01 3.500000e-01 3.600000e-01 3.700000e-01 3.800000e-01 3.900000e-01
4.120000e-01 4.200000e-01 4.300000e-01 4.400000e-01 4.500000e-01 4.600000e-01 4.700000e-01 4.800000e-01 4.900000e-01
5.120000e-01 5.200000e-01 5.300000e-01 5.400000e-01 5.500000e-01 5.600000e-01 5.700000e-01 5.800000e-01 5.900000e-01
6.120000e-01 6.200000e-01 6.300000e-01 6.400000e-01 6.500000e-01 6.600000e-01 6.700000e-01 6.800000e-01 6.900000e-01
7.120000e-01 7.200000e-01 7.300000e-01 7.400000e-01 7.500000e-01 7.600000e-01 7.700000e-01 7.800000e-01 7.900000e-01
8.120000e-01 8.200000e-01 8.300000e-01 8.400000e-01 8.500000e-01 8.600000e-01 8.700000e-01 8.800000e-01 8.900000e-01
9.120000e-01 9.200000e-01 9.300000e-01 9.400000e-01 9.500000e-01 9.600000e-01 9.700000e-01 9.800000e-01 9.900000e-01
Where line 1 is a header, and the remaining lines represent repeatable data blocks. I'm looking to open the file in MATLAB, rectangularize each data block as a 14x9 matrix for specific plots, and save the file.
Is this possible with MATLAB?
Thank you.
3 commentaires
Walter Roberson
le 26 Mar 2013
The obvious data block appears to be 9 x 9. Where would the other (5 x 9) = 45 values come from?
Ahmed A. Selman
le 26 Mar 2013
Explain the second line, please:
001 25.187466 156.162447 21578.188 97.134234 stops AAAAA ..etc
is it all needed as a text or you intend to use the info there in a specific way? Anyway try the
fscanf
function, it can read pre-formatted data from a file, exactly as you desire i.e. numeric, text, precision, ..etc.
Brad
le 27 Mar 2013
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Large Files and Big Data dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!