Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: How to detect if calling engEvalString() has caused an error?

Subject: How to detect if calling engEvalString() has caused an error?

From: Sven Fischer

Date: 22 Apr, 2008 17:20:03

Message: 1 of 3

Hallo!

I've been doing some C++ programming, using the Matlab
Engine. I'm using the engEvalString() function to execute a
number of "unknown" m-files, meaning I do not know whether
these script files do contain errors or not. Therefor I'd
like to get some feedback, on the called script, i.e. if
matlab encounterd an error running the specified m-file.

I'm already checking the return value of engEvalString(),
but this is not working for erros that are caused by the
executed commands, i.e. the m-file. I've also tried to
retrieve the matlab output by using engOutputBuffer(), but
since I do not know how to determine if it contains an
error message or a regula output, it's no help either.

So, does anyone know a way of detecting errors within
commands that are executed via engEvalString()?

TIA
Sven

Subject: How to detect if calling engEvalString() has caused an error?

From: James Tursa

Date: 22 Apr, 2008 19:23:01

Message: 2 of 3

"Sven Fischer" <fisher311-matlab@yahoo.de> wrote in
message <ful6o2$bq4$1@fred.mathworks.com>...
>
> So, does anyone know a way of detecting errors within
> commands that are executed via engEvalString()?

I don't think there is any way, unfortunately. The things
you are trying (e.g., try to get the result and see if you
got it ok and the values are reasonable) are the only
things I am aware of.

James Tursa


Subject: How to detect if calling engEvalString() has caused an error?

From: Sven Fischer

Date: 23 Apr, 2008 08:37:02

Message: 3 of 3

"James Tursa" <aclassyguywithaknotac@hotmail.com> wrote in
message <fuldul$475$1@fred.mathworks.com>...
> "Sven Fischer" <fisher311-matlab@yahoo.de> wrote in
> message <ful6o2$bq4$1@fred.mathworks.com>...
> >
> > So, does anyone know a way of detecting errors within
> > commands that are executed via engEvalString()?
>
> I don't think there is any way, unfortunately. The things
> you are trying (e.g., try to get the result and see if you
> got it ok and the values are reasonable) are the only
> things I am aware of.

I was afraid to hear that. Otherwise life would be way too
easy. ;-) Thanks anyway.

I guess I'll have to use a workaround like evaluating "clear
success; myScript; success=1;" and trying to retrieve the
"success" variable from Matlab.

Best wishes,
Sven

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
external interface Sven Fischer 23 Apr, 2008 04:40:22
error handling Sven Fischer 22 Apr, 2008 13:20:06
engevalstring Sven Fischer 22 Apr, 2008 13:20:06
engine Sven Fischer 22 Apr, 2008 13:20:06
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics