stack-delay
stack-delay

Reputation: 195

Finding location where Matlab warning was triggered

I have a large codebase in Matlab (2021a Update 5, running on Mac) which triggers the warning:

Warning: Integer operands are required for colon operator when used as index.

But there is no information about where this warning is triggered. How can I find out what file and line-number it came from? So I can adress the problem.

Upvotes: 2

Views: 96

Answers (1)

stack-delay
stack-delay

Reputation: 195

Cris Luengo provided an excellent solution in a comment, so I thought I might repeat it and flag the question as answered.

To break the execution at the first line that's triggering a warning, run the following command in the Command Window beforehand.

dbstop if warning

From what I can tell, the following command resets this option.

dbclear all

Upvotes: 1

Related Questions