- What delimiter is used between the columns in the text file?
how to remain the original matrix dimension and remove blank cells
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear All, I imported data from a text file, this text file has 300000 rows and must have 105 columns for example. when i import it as vector matrices, all the vectors must have a length of 300000 as the original matrix A (which is the file). but it does not do that, I found out the reason is maybe because many rows has blank cells, how can i please tell MATLAB to remove the blank cells and put zeros instead so I keep the original dimension? thank you in advance
1 commentaire
Réponses (1)
Image Analyst
le 30 Oct 2017
If you've got blank rows at strange places, then you may just have to read in the file line-by-line with fgetl() and check for bad or blank rows. Then, if the row is good, get the numbers out, else skip it. See help for fgetl(,) and sscanf() or textscan().
2 commentaires
Voir également
Catégories
En savoir plus sur Data Import and Export 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!