Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
debug... stop if errors or warnings

Subject: debug... stop if errors or warnings

From: Nick

Date: 1 Nov, 2012 22:12:08

Message: 1 of 3

In the debug menu under stop if errors or warnings there is an option
"Use message identifiers (dbstop if error messageid)"

I would like instead to dbstop at all errors EXCEPT a certain one, particularly MATLAB:MEX:genericFailure as it is quite annoying to manually have to exit debug mode whenever i get compiler errors

Subject: debug... stop if errors or warnings

From: Steven_Lord

Date: 2 Nov, 2012 13:50:52

Message: 2 of 3



"Nick " <dsfadfa@aol.com> wrote in message
news:k6us3o$s0q$1@newscl01ah.mathworks.com...
> In the debug menu under stop if errors or warnings there is an option
> "Use message identifiers (dbstop if error messageid)"
>
> I would like instead to dbstop at all errors EXCEPT a certain one,
> particularly MATLAB:MEX:genericFailure as it is quite annoying to manually
> have to exit debug mode whenever i get compiler errors

I don't know of a way to do that.

If you're attempting to create a MEX-file and if it's acceptable for that
process to fail in your application, wrap your MEX call in a TRY/CATCH
block. If the caught error's identifier is MATLAB:MEX:genericFailure, simply
continue on with your work; if it is not, RETHROW it, somewhat like the
first example on the TRY/CATCH documentation page.

http://www.mathworks.com/help/matlab/ref/try.html

However I would question whether or not it's acceptable for the MEX-file to
fail to be compiled. MATLAB in general doesn't throw errors "just because."
Errors are like pain to a human body; they're an indication of a larger
problem, meant to draw your attention so you can fix the problem.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: debug... stop if errors or warnings

From: Nick

Date: 2 Nov, 2012 16:13:08

Message: 3 of 3

it throws an error when you mex something and it fails to compile due to errors in the C-code.
wrapping it in a try catch is a good idea, I'll do that. it's just a bit cumbersome

"Steven_Lord" <slord@mathworks.com> wrote in message <k70j3s$1cm$1@newscl01ah.mathworks.com>...
>
>
> "Nick " <dsfadfa@aol.com> wrote in message
> news:k6us3o$s0q$1@newscl01ah.mathworks.com...
> > In the debug menu under stop if errors or warnings there is an option
> > "Use message identifiers (dbstop if error messageid)"
> >
> > I would like instead to dbstop at all errors EXCEPT a certain one,
> > particularly MATLAB:MEX:genericFailure as it is quite annoying to manually
> > have to exit debug mode whenever i get compiler errors
>
> I don't know of a way to do that.
>
> If you're attempting to create a MEX-file and if it's acceptable for that
> process to fail in your application, wrap your MEX call in a TRY/CATCH
> block. If the caught error's identifier is MATLAB:MEX:genericFailure, simply
> continue on with your work; if it is not, RETHROW it, somewhat like the
> first example on the TRY/CATCH documentation page.
>
> http://www.mathworks.com/help/matlab/ref/try.html
>
> However I would question whether or not it's acceptable for the MEX-file to
> fail to be compiled. MATLAB in general doesn't throw errors "just because."
> Errors are like pain to a human body; they're an indication of a larger
> problem, meant to draw your attention so you can fix the problem.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us