Why can dlmread not open a file created with dlmwrite?
3 views (last 30 days)
Show older comments
Hi I created and .txt file with the function dlmwrite in order not to rerun the previous code for collecting values from over a 1 000 files. The file is created from the 1701733x23 matrix (numeric).
When the same file is imported in and other script the error:"DELIMITER must be a single character." is displayed.
The code (from command window):
>> dlmwrite('Erzberg_All_Raw_Data_MWD_new.txt',MWD_Data_All2,'delimiter',',');
>> MWD_Data_All2=dlmread('Erzberg_All_Raw_Data_MWD_new.txt','delimiter',',');
Error using dlmread (line 75)
DELIMITER must be a single character.
The same happens if i use a tab as delimiter.
The work is done in the same computer and same matlab version (only different scripts).
Any explanation or a suitable work around? Can it be caused by a clogged RAM (nearly all space is used)?
Cheers Jeroen
4 Comments
per isakson
on 1 Dec 2017
Edited: per isakson
on 1 Dec 2017
Yes, isn't it? There is, however, an explanation. Matlab has been a commercial product for 30+ years and before that a teaching tool for ten years. The Mathworks does a good job in morphing Matlab to keep up with time and at the same time provide backward compatibility.
dlmread still stays with the old syntax. dlmwrite honors the old syntax; it works without the new keyword, delimiter. I bet, dlmread will understand the new keyword, delimiter, in a year or two.
btw: This was the first time I noticed the new keyword, delimiter, with this function.
Ethan Knights
on 19 Mar 2021
I just wound up here by making a similar mistake ~3 years later - give it a few more years for the transition!
Answers (0)
See Also
Categories
Find more on Text Files in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!