Borrar filtros
Borrar filtros

dlmread problem could not read file

6 visualizaciones (últimos 30 días)
strunack
strunack el 19 de Dic. de 2012
I have a text file with tab delimiter. I use
B=dlmread('mon3.txt','',[2 0 20 1]);size (B)
With whatever combination of range, I cannot read the file. If I remove
"Array 1 8192 #startdata" from the first line then I am able to read the file. Its strange. Pls help how to get rid of this problem. Using textscan and fread gives strange values. I want to attach the file mon3.txt itself, but dont know how to do it.
Secondly, I want to mention that I do read variety of files using dlmread and never has any problem.
tks

Respuestas (1)

Walter Roberson
Walter Roberson el 19 de Dic. de 2012
dlmread() can only be used for files that are completely numeric, including in the portions of the file that are to be skipped.
Please show a typical line, and please show your attempt to use textscan()
  1 comentario
strunack
strunack el 20 de Dic. de 2012
#'time(sec)' 'mon1' Array 1 8192 T#startdata
0.0 -0.029296875
0.02 -0.029296875
0.04 -0.029296875
0.06 -0.0390625
0.08 -0.048828125
0.1 -0.048828125
0.12 -0.029296875
0.14 -0.029296875
0.16 -0.029296875
0.18 -0.048828125
first few lines of text file looks like this. Now if I remove text
Array 1 8192 #startdata
then I could read using dlmread. Absolutely no problem. So I do not agree with your comment that dlmread cannot read non numeric files. I regularly read files with similar format. But I am stumped to notice this problem with this perticular file. The error is
Error using dlmread (line 139)
Mismatch between file and format string.
Trouble reading number from file (row 1u, field 1u)
==> Array 1 8192 T\n

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by