Thread Subject: cannot start matLab engine

Subject: cannot start matLab engine

From: Bill

Date: 24 Jan, 2008 15:37:01

Message: 1 of 6

Well, I cannot reliably start the MatLab engine from a C
program. Last week it seemed to work every time that I
tried. This week it has only worked once. The return from:

  if (!(ep = engOpen("\0")))
  {
    fprintf(stderr, "\nCan't start MATLAB engine\n");
    return EXIT_FAILURE;
  }

has indicated failure almost every time. The followinf may
be related - I have version 2006a installed and yesterday
installed and uninstalled and reinstalled version 2007b. I
now have both installed. I am running my C program from
Visual Studio and have watched both versions being invoked
(not at the same time) when I execute the code above, but I
cannot tell why one version is chosen over the other. In
any case, the above code now fails every time. There is
obviously a lot that I do not understand here.

Any thoughts?

TIA

Bill

Subject: cannot start matLab engine

From: John reilly

Date: 24 Jan, 2008 16:07:02

Message: 2 of 6

Probably, your issue is that your PATH is messed up. if
the MATLAB engine DLL that you want to use is not on your
PATH, and/or your are linking to the wrong LIB file for the
DLL that is on your path, you will have issues.

Make sure you are linking to the right LIB. Make sure that
the corresponding DLL is on your path.

HTH.

reilly.



"Bill " <john.doe.nospam@mathworks.com> wrote in message
<fnabat$8ol$1@fred.mathworks.com>...
> Well, I cannot reliably start the MatLab engine from a C
> program. Last week it seemed to work every time that I
> tried. This week it has only worked once. The return from:
>
> if (!(ep = engOpen("\0")))
> {
> fprintf(stderr, "\nCan't start MATLAB engine\n");
> return EXIT_FAILURE;
> }
>
> has indicated failure almost every time. The followinf
may
> be related - I have version 2006a installed and yesterday
> installed and uninstalled and reinstalled version 2007b.
I
> now have both installed. I am running my C program from
> Visual Studio and have watched both versions being
invoked
> (not at the same time) when I execute the code above, but
I
> cannot tell why one version is chosen over the other. In
> any case, the above code now fails every time. There is
> obviously a lot that I do not understand here.
>
> Any thoughts?
>
> TIA
>
> Bill

Subject: cannot start matLab engine

From: Steven Lord

Date: 24 Jan, 2008 18:25:31

Message: 3 of 6


"Bill " <john.doe.nospam@mathworks.com> wrote in message
news:fnabat$8ol$1@fred.mathworks.com...
> Well, I cannot reliably start the MatLab engine from a C
> program. Last week it seemed to work every time that I
> tried. This week it has only worked once. The return from:
>
> if (!(ep = engOpen("\0")))
> {
> fprintf(stderr, "\nCan't start MATLAB engine\n");
> return EXIT_FAILURE;
> }
>
> has indicated failure almost every time. The followinf may
> be related - I have version 2006a installed and yesterday
> installed and uninstalled and reinstalled version 2007b. I
> now have both installed. I am running my C program from
> Visual Studio and have watched both versions being invoked
> (not at the same time) when I execute the code above, but I
> cannot tell why one version is chosen over the other. In
> any case, the above code now fails every time. There is
> obviously a lot that I do not understand here.

Since you refer to Visual Studio, I assume you're on Windows. If so, is the
correct MATLAB installation registered as per the last part of the
Description section of the reference page for engOpen?

http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/apiref/engopen.html

Just to cover the other base, if you're on UNIX, what happens when you type
"matlab" at a terminal prompt? That's what the documentation says engOpen
will do in the case you described. Perhaps that will offer some additional
information about the cause of this problem.

If that doesn't work, you may want to contact technical support -- they
should have some additional diagnostics you can try to determine the cause
of this behavior.

--
Steve Lord
slord@mathworks.com

Subject: cannot start matLab engine

From: Bill

Date: 24 Jan, 2008 18:27:01

Message: 4 of 6

Thanks John. I did check that my VS linker was pointing at:

"C:\Program Files\MATLAB\R2007b\bin\win32"

and that the PATH environment variable also pointed there.
Any thing else?

Bill


"John Reilly" <jrhokie1.nospam@yahoo.com> wrote in message
<fnad36$90u$1@fred.mathworks.com>...
> Probably, your issue is that your PATH is messed up. if
> the MATLAB engine DLL that you want to use is not on your
> PATH, and/or your are linking to the wrong LIB file for
the
> DLL that is on your path, you will have issues.
>
> Make sure you are linking to the right LIB. Make sure
that
> the corresponding DLL is on your path.
>
> HTH.
>
> reilly.
>
>
>
> "Bill " <john.doe.nospam@mathworks.com> wrote in message
> <fnabat$8ol$1@fred.mathworks.com>...
> > Well, I cannot reliably start the MatLab engine from a
C
> > program. Last week it seemed to work every time that I
> > tried. This week it has only worked once. The return
from:
> >
> > if (!(ep = engOpen("\0")))
> > {
> > fprintf(stderr, "\nCan't start MATLAB engine\n");
> > return EXIT_FAILURE;
> > }
> >
> > has indicated failure almost every time. The followinf
> may
> > be related - I have version 2006a installed and
yesterday
> > installed and uninstalled and reinstalled version
2007b.
> I
> > now have both installed. I am running my C program from
> > Visual Studio and have watched both versions being
> invoked
> > (not at the same time) when I execute the code above,
but
> I
> > cannot tell why one version is chosen over the other.
In
> > any case, the above code now fails every time. There is
> > obviously a lot that I do not understand here.
> >
> > Any thoughts?
> >
> > TIA
> >
> > Bill
>

Subject: cannot start matLab engine

From: Bill

Date: 24 Jan, 2008 18:44:02

Message: 5 of 6

Steve,

I did notice that earlier and did indeed explicitly
register 2007b as a COM server. HOWEVER, I bet that 2006a
is still registered and that I am somehow envoking both of
them. I am going to uninstall 2006a and see if that helps.
I'll let you know.

Bill



"Steven Lord" <slord@mathworks.com> wrote in message
<fnal6r$h6k$1@fred.mathworks.com>...
>
> "Bill " <john.doe.nospam@mathworks.com> wrote in message
> news:fnabat$8ol$1@fred.mathworks.com...
> > Well, I cannot reliably start the MatLab engine from a C
> > program. Last week it seemed to work every time that I
> > tried. This week it has only worked once. The return
from:
> >
> > if (!(ep = engOpen("\0")))
> > {
> > fprintf(stderr, "\nCan't start MATLAB engine\n");
> > return EXIT_FAILURE;
> > }
> >
> > has indicated failure almost every time. The followinf
may
> > be related - I have version 2006a installed and
yesterday
> > installed and uninstalled and reinstalled version
2007b. I
> > now have both installed. I am running my C program from
> > Visual Studio and have watched both versions being
invoked
> > (not at the same time) when I execute the code above,
but I
> > cannot tell why one version is chosen over the other. In
> > any case, the above code now fails every time. There is
> > obviously a lot that I do not understand here.
>
> Since you refer to Visual Studio, I assume you're on
Windows. If so, is the
> correct MATLAB installation registered as per the last
part of the
> Description section of the reference page for engOpen?
>
>
http://www.mathworks.com/access/helpdesk/help/techdoc/index.
html?/access/helpdesk/help/techdoc/apiref/engopen.html
>
> Just to cover the other base, if you're on UNIX, what
happens when you type
> "matlab" at a terminal prompt? That's what the
documentation says engOpen
> will do in the case you described. Perhaps that will
offer some additional
> information about the cause of this problem.
>
> If that doesn't work, you may want to contact technical
support -- they
> should have some additional diagnostics you can try to
determine the cause
> of this behavior.
>
> --
> Steve Lord
> slord@mathworks.com
>
>

Subject: cannot start matLab engine

From: Bill

Date: 24 Jan, 2008 20:07:02

Message: 6 of 6

Well uninstalling version 2006a and rebooting seems to have
done the trick!!!




"Bill " <john.doe.nospam@mathworks.com> wrote in message
<fnam9i$5d6$1@fred.mathworks.com>...
> Steve,
>
> I did notice that earlier and did indeed explicitly
> register 2007b as a COM server. HOWEVER, I bet that 2006a
> is still registered and that I am somehow envoking both
of
> them. I am going to uninstall 2006a and see if that
helps.
> I'll let you know.
>
> Bill
>
>
>
> "Steven Lord" <slord@mathworks.com> wrote in message
> <fnal6r$h6k$1@fred.mathworks.com>...
> >
> > "Bill " <john.doe.nospam@mathworks.com> wrote in
message
> > news:fnabat$8ol$1@fred.mathworks.com...
> > > Well, I cannot reliably start the MatLab engine from
a C
> > > program. Last week it seemed to work every time that I
> > > tried. This week it has only worked once. The return
> from:
> > >
> > > if (!(ep = engOpen("\0")))
> > > {
> > > fprintf(stderr, "\nCan't start MATLAB engine\n");
> > > return EXIT_FAILURE;
> > > }
> > >
> > > has indicated failure almost every time. The
followinf
> may
> > > be related - I have version 2006a installed and
> yesterday
> > > installed and uninstalled and reinstalled version
> 2007b. I
> > > now have both installed. I am running my C program
from
> > > Visual Studio and have watched both versions being
> invoked
> > > (not at the same time) when I execute the code above,
> but I
> > > cannot tell why one version is chosen over the other.
In
> > > any case, the above code now fails every time. There
is
> > > obviously a lot that I do not understand here.
> >
> > Since you refer to Visual Studio, I assume you're on
> Windows. If so, is the
> > correct MATLAB installation registered as per the last
> part of the
> > Description section of the reference page for engOpen?
> >
> >
>
http://www.mathworks.com/access/helpdesk/help/techdoc/index.
> html?/access/helpdesk/help/techdoc/apiref/engopen.html
> >
> > Just to cover the other base, if you're on UNIX, what
> happens when you type
> > "matlab" at a terminal prompt? That's what the
> documentation says engOpen
> > will do in the case you described. Perhaps that will
> offer some additional
> > information about the cause of this problem.
> >
> > If that doesn't work, you may want to contact technical
> support -- they
> > should have some additional diagnostics you can try to
> determine the cause
> > of this behavior.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> >
> >
>

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
matlab engine Bill 24 Jan, 2008 10:40:11
rssFeed for this Thread

Contact us at files@mathworks.com