Why can dlmread not open a file created with dlmwrite?

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 commentaires

per isakson
per isakson le 1 Déc 2017
Modifié(e) : per isakson le 1 Déc 2017
Surprise, replace
MWD_Data_All2=dlmread('Erzberg_All_Raw_Data_MWD_new.txt','delimiter',',');
by
MWD_Data_All2=dlmread('Erzberg_All_Raw_Data_MWD_new.txt',',');
Thanks a lot Per, How nice the standardization of Matlab functions...
per isakson
per isakson le 1 Déc 2017
Modifié(e) : per isakson le 1 Déc 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.
I just wound up here by making a similar mistake ~3 years later - give it a few more years for the transition!

Connectez-vous pour commenter.

Réponses (0)

Produits

Question posée :

le 1 Déc 2017

Commenté :

le 19 Mar 2021

Community Treasure Hunt

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

Start Hunting!

Translated by