when I load a dat file Iam getting this error how to rectify this?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
when I load a dat file Iam getting this error how to rectify this?
load('100.dat')
??? Error using ==> load
Number of columns on line 5 of ASCII file
C:\Users\SHEEJA\Documents\MATLAB\100.dat
must be the same as previous lines.
0 commentaires
Réponses (2)
Friedrich
le 3 Sep 2012
Hi,
the error seems pretty straight forward doesn't it?
Number of columns on line 5 of ASCII file
C:\Users\SHEEJA\Documents\MATLAB\100.dat
must be the same as previous lines.
Open the dat file in a txt editor and take a look at line 5 and 4. There should be a difference in the amount of values stored per line.
Maybe consider using textscan to read in the data.
If you post how the data is stored in the data file, the community can suggest you ways to read it in.
2 commentaires
Friedrich
le 4 Sep 2012
Hi,
see here:
I doubt this answers is correct but there is no straight forward way of doing this.
Take a look in the programmers guide:
Seems like one could go the mex way and use the libraries which they provide or start from scratch with plain MATLAB code.
Jan
le 3 Sep 2012
Modifié(e) : Jan
le 3 Sep 2012
The documentation of load explains, that this command is thought for files, which are created by save. The error message means, that your DAT files do neither match the binary nor ASCII format of MAT-files.
Friedrich's suggestion of textscan is most likely efficient. Depending on the format of your files, other methods could be easier. When you post some example data, a more detailed suggestion is possible.
[EDITED] after you have posted the link to the data:
The file data looks like:
À3À3À3À3À3À3À3À#úû#í5$ßt$ѹ$Ç%ÅN%Å’%ÌÀ%ÛÏ%ïµ5
Obviously the file has a binary format, perhaps it can be read by:
fid = fopen(FileName);
if fid < 0, error('Cannot open file'); end
Data = fread(fid, Inf, 'float32');
fclose(fid);
But this is a pure guessing. You either have to find the exact definition of the format or to contact the author.
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!