how can I extract the data fast?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I got one .dat or .txt or .xlsx file with complicated header, and i only need the data at every maybe 15th line.
Could you give a favor to extract the data out, then I can histc them.
Many thanks......
0 commentaires
Réponses (1)
Walter Roberson
le 4 Sep 2015
There is no standard format for .dat files; .dat is similar to .bin in that any program can use it to mean anything and it is not necessarily the same from one version of a program to another. However, if you were to restrict the .dat to having been created by one particular program, it is possible that that program has chosen to use a well-defined and documented structure for the files that could potentially be researched.
.xslx files are verbose and not really designed for fast reading.
.txt files can also mean different things to different programs. However, .txt files are usually human readable well enough for a programmer to be able to deduce the storage format (something that is tricky with a binary format such as .dat) so it is more likely that there is a reasonable solution for .txt files.
Sometimes the solution is to loop using textscan() with a Headerlines option to skip over the unwanted lines and telling textscan to read one line only (textscan does not have an easy way to skip lines between entries -- though it can be done.)
Sometimes the solution is to use a loop to fscanf() the wanted lines and then loop fgetl() to skip the unwanted lines.
Sometimes the best solution is to use an external tool such as Perl to reduce the data down to just the wanted lines and then to process those in MATLAB.
0 commentaires
Voir également
Catégories
En savoir plus sur Large Files and Big Data dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!