Why can dlmread not open a file created with dlmwrite?

조회 수: 3 (최근 30일)
Jeroen
Jeroen 2017년 12월 1일
댓글: Ethan Knights 2021년 3월 19일
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
per isakson
per isakson 2017년 12월 1일
편집: per isakson 2017년 12월 1일
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
Ethan Knights 2021년 3월 19일
I just wound up here by making a similar mistake ~3 years later - give it a few more years for the transition!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by