Trouble reading txt file using dlmread

Hi,
Suddenly, Matlab doesn't allow me to read text files. The file is in the MATLAB folder, like in the past.. I just copied it's name and tried loading in to MATLAB to further work on it.. but it gives me error. First it said that the file wasn't even there (the folder is synced to iCloud)
Now it says:
"Error using dlmread (line 147)
Mismatch between file and format character vector.
Trouble reading 'Numeric' field from file (row number 29200, field number 10) ==> ********* 4.3043 4.60E+04
7.78E-01 3.42E+08 0.00E+00 0.00E+00 1.88E-04\n
"
This is the command I put: EvoFileSuc = dlmread('l_He7Div')
I'm using Mac OSx.
Mind you - this is a file that I have successfuly loaded to matlab in the past, so I have NO idea why suddenly this says that..
Any thoughts?
Thanks!

6 Comments

Have you tried copying the file in a non-synced folder?
Have you checked that the file is not corrupted?
I have not. It's synced to iCloud as it's my thesis, so I'm trying to backup everything.. I tried turning it off, but it says that it would delete everything, so I don't want to take a chance. Can I read from a folder that's not MATLAB's folder?
Thanks
You can read files from any folder. They don't need to be on the matlab path. In fact, it's better if only code folders are on the matlab path. Just pass the full path of the file to dlmread
dlmread(fullfile('somewhere/somefolder/notonthepath', 'l_He7Div'))
Still gives me an error:
Error using dlmread (line 147)
Mismatch between file and format character vector.
Trouble reading 'Numeric' field from file (row number 29200, field number 10) ==> ********* 4.3043 4.60E+04
7.78E-01 3.42E+08 0.00E+00 0.00E+00 1.88E-04\n
Same on I think :( wth :((
Thanks for the help!! Much apprecaited
i think the file has astrikes on it! That's why I can't read it! Do you know how to clear a file from astrikes (delete the whole row where the astrike appear, regardless of the colum??)
Thanks <3
Stephen23
Stephen23 on 29 Jan 2019
Edited: Stephen23 on 29 Jan 2019
@itzhak mal: please upload a sample file in a new comment by clicking the paperclip button.
It does not have to be the entire file, just enough of it to show the behavior that you experience.

Sign in to comment.

Answers (0)

Asked:

on 29 Jan 2019

Edited:

on 29 Jan 2019

Community Treasure Hunt

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

Start Hunting!