Fri 14 Oct 2016 02:04:55 PM UTC, comment #4:
This is what I thought. dlmread in Octave is also coded to expect numeric input. When you do not specify a delimiter, Octave has to search the file to find one and it is looking for a pattern of "NUMBER<delimiter>". The file in this bug report is "TEXT,NUMBER" so Octave finds the end of line character rather than a delimiter and concludes that there is only one column of data.
We could try relaxing the constraint to be "ANY_TEXT<delimiter>". I don't know what other effects that might have, although 'make check' still passes. I made that change here http://hg.savannah.gnu.org/hgweb/octave/rev/e7699adac1d0. I'm going to mark this report as Ready for Test, and will leave it open for a while since I'm not certain that this won't introduce other subtle bugs later.
|
Fri 14 Oct 2016 12:40:47 PM UTC, comment #3:
(Just intermediate result, I have had no time to dive into importdata.m again, so here are just Matlab results)
Matlab r2016b gives:
Note that Matlab doesn't accept 'emptyvalue'. Specifying a comas as separator makes no difference.
Octave-4.3.0+ does (specifying a comma as delimiter, ):
which looks to be all right if not better than expected or Matlab (given that dlmread cannot read non-numeric data).
Specifying an empty string (indicating dlmread should assess the delimiter itself) gives:
so dlmread apparently has trouble finding out the separator character.
|
Wed 12 Oct 2016 07:44:41 PM UTC, comment #2:
IIRC, and based on reading the importdata.m's bug report (bug #41630) that triggered this report, I'd need to check importdata's behavior again.
So yes, dlmread is used outside its specs, but that may be due to importdata.m.
Tomorrow I hope to have a chance to check w. Matlab.
|
Wed 12 Oct 2016 03:27:37 PM UTC, comment #1:
What does Matlab do for the same input?
I've checked the code in dlmread.cc and the issue is that dlmread is built to read only numeric data. The documentation from Matlab is also clear that the function is only for numeric data (http://www.mathworks.com/help/matlab/ref/dlmread.html).
I agree it would be nice to have a better warning message, but it also might not be worth fixing since this is a corner case and the function is not being used according to its docstring so all bets are off.
|
Tue 01 Apr 2014 07:48:38 PM UTC, original submission:
While trying to fix importdata.m (see bug #41630) I hit some errors with dlmread.
File imp3.txt:
aaaa,11
bbbb,
cccc,33
(note trailing space on line 2 after comma)
The bug is that dlmread shouldn't error out but rather emit a sensible error message.
|