Why does DLMREAD return a column vector when I used DLMWRITE to create an ASCII-delimited file with a row vector in MATLAB 7.1 (R14SP3)?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I used DLMWRITE to write a large (> 100,000 elements) row vector to a tab-delimited ASCII file. When I read it back into MATLAB with DLMREAD, it is read as a column vector. This also happens when using TEXTSCAN.
Réponse acceptée
MathWorks Support Team
le 27 Juin 2009
This is the expected behavior in MATLAB 7.1 (R14SP3). DLMREAD calls TEXTSCAN, which has a current limit of 100,000. Thus, a single line with more than 100,000 fields is read in as a column, instead of a row by TEXTSCAN. This allows TEXTSCAN to use a single cell holding an array as opposed to a large cell array, thereby providing improvements in memory and hence speed.
To work around this issue, use the data Import Wizard or the LOAD command with the following syntax:
load -ascii filename.dat
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Text Files 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!