when I load a dat file Iam getting this error how to rectify this?

4 vues (au cours des 30 derniers jours)
Sheeja Wilson
Sheeja Wilson le 3 Sep 2012
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.

Réponses (2)

Friedrich
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
Sheeja Wilson
Sheeja Wilson le 3 Sep 2012
Sir, Iam doing my project in signal processing I have to do fuzzy clustering of signals from MIT-BIH arrhythmia database. Inorder to do FCM the signal should be in dat format but I got signals in Mat format.How to convert signals to dat format?
Friedrich
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.

Connectez-vous pour commenter.


Jan
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À#úû#í5t$ѹ$Ç%Å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.
  1 commentaire
Sheeja Wilson
Sheeja Wilson le 3 Sep 2012
I have obtained dat file from this website http://physionet.org/physiobank/database/mitdb/ but Iam not able to load this in matlab.

Connectez-vous pour commenter.

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!

Translated by