Rare examples of confusing error messages

9 次查看(过去 30 天)
Usually Matlab creates very helpful error messages, e.g.:
??? Subscript indices must either be real positive integers or logicals.
It does not require much experience to identify the source of this error rapidly. (Finding a solution is completely different story!) Compared with e.g. the messages of famous operating systems or the GCC compiler, the high quality of these messages is extremely helpful.
Do you know counter-examples? Some misleading or irrelevant messages created by Matlab?
  3 个评论
Jan
Jan 2013-1-17
编辑:Jan 2013-1-17
@Daniel: And I like the small number of answers. As a rough estimation 6 of 10'000 error and warning messages are not useful!
Somebody tagged this question with "almost humor". But can you image suiting tags for a similar question in a MS forum? "hate", "blunt", "rudeness", "lunacy". Therefore I think this thread points out a very good reason to use Matlab to solve problem efficiently. And therefore the certain level of humor is an evidence of the seriosity of the topic.
James Muchechetere
James Muchechetere 2019-8-23
Yes. Got this message in r2017a:
Error using CPFSKModulator/parenReference
When the BitInput property is set to true, inputs must have be double or logical.

请先登录,再进行评论。

采纳的回答

Andreas Goser
Andreas Goser 2012-4-24
My all-time favourite is
Caught unexpected exception of unknown type.
  7 个评论

请先登录,再进行评论。

更多回答(8 个)

Jan
Jan 2012-4-24
In Matlab5.3 (R11), but not in modern releases:
% First time:
reshape(1, [-1 -1])
??? Error using ==> reshape
Don't do this again!.
% Second time:
reshape(1, [-1 -2])
??? Error using ==> reshape
Cleve says you should be doing something more useful.
% Third time:
reshape(1, [-1 -3])
??? Error using ==> reshape
Seriously, size argument cannot be negative.

Daniel Shub
Daniel Shub 2012-4-23
Definitely on the irrelevant side, but luckily it was taken care of pretty quickly. I think it might be the first bug I reported to TMW.
Basically someone at TMW left a debugging message in the serial port object callback so that it would always rethrow the last warning.

Oleg Komarov
Oleg Komarov 2012-4-23
The guilty one:
foo('')
Undefined function 'foo' for input arguments of type 'char'.
No inputs:
foo
Undefined function or variable 'foo'.
Use as variable OR function?
clear foo
sum(foo)
Undefined function or variable 'foo'.
The two error messages considered together make you think that the first one is simply not properly behaving BECAUSE of the input.
However, most commonly it's the case of "undefined function" which is already implemented!
I suggest to suppress the first one and throw always the second message.
  5 个评论
Image Analyst
Image Analyst 2012-4-24
Seems to me it should look it up by function name (m-filename). So it should look for foo.m, not all possible functions of any name that take a class char (which would be a lot) and then determine if any of them are named foo.
Jan
Jan 2012-4-24
It would be helpful to get one of these messages:
Either:
>> Undefined function 'foo' for input arguments of type 'char'
>> But there are these foo() functions for other inputs: ...
Or:
>> Undefined function 'foo' for input arguments of type 'char'
>> There is no other foo() function also.

请先登录,再进行评论。


Daniel Shub
Daniel Shub 2012-4-23
Another unhelpful aspect of error handling in MATLAB is if you catch an error in a callback and then rethrow the error, you lose the stack information.

Walter Roberson
Walter Roberson 2012-4-26
Invoke Error, Dispatch Exception: Exception Error Occurred
isn't the most enlightening of messages...

Jan
Jan 2017-1-17
Error using load
Number of columns on line 1 of ASCII file
C:\xyz.dat
must be the same as previous lines.
Most likely the text format does not match the one written by save -ascii, but where can I find the previous line of line 1?

Adam
Adam 2017-1-17
was one I got the other day. Not sure what I had done to get it though! I especially like the one word per line formatting!
  2 个评论
Steven Lord
Steven Lord 2017-1-17
I searched a little bit and I'm not sure that's from a MathWorks function. [It is being displayed in a msgbox with the 'error' Icon, I believe, but that's a function anyone can call.]
Adam
Adam 2017-1-18
It's definitely something deep down as I got it again yesterday when I tried to open a file that I had moved and was actually not on my path any more. I hit Ctrl C or pause or something and ended up with that message. It isn't something in my own code or 3rd party code that I have though so not sure what its source is!

请先登录,再进行评论。


Jan
Jan 2017-6-20
编辑:Jan 2017-8-22
A = rand(1393120, 1);
xlswrite('Test.xlsx', A)
Error using xlswrite (line 219)
The specified data range is invalid or too large to write to the
specified file format. Try writing to an XLSX file and use Excel A1
notation for the range argument, for example, A1:D4.
Since Excel 2007 only up to 1'048'576 rows (2^20) are accepted. Then "too large" is fine and Matlab has all information to detect this. Suggesting an XLSX file and "A1:A1393120" will not solve the problem.

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by