comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Calling Matlab engine from IDL,
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Calling Matlab engine from IDL, [message #38670] Wed, 24 March 2004 09:21
Lars G. Hanson is currently offline  Lars G. Hanson
Messages: 2
Registered: June 1999
Junior Member
In order to make use of a library of Matlab-functions from IDL, I
attempted to use freely available software located at
http://hendrix.imm.dtu.dk/software/atlant/atlant.html for spawning a
matlab engine by call_external (interface written by Finn Aarup
Nielsen and Peter Toft).

After minor adaptions to matlab 6.5 (given below), Finns and Peters
code works very nicely UNTIL the first IDL graph is plotted. After
that it seems impossible to get data back from Matlab via
call_external. If IDL graphics has been used at any time in an IDL
session, it is impossible to get the matlab session running at all.

Until now, I would have thought that call_external and graphics were
independent, but no. I'm running Matlab IDL 5.4, Matlab 6.5, Redhat 9.
Even though Finn and Peter wrote the code for earlier versions of IDL
and Matlab, they experienced the same problem (SGI platform).

Any ideas on cause or solution?

Cheers,
Lars, larsh#drcmr.dk
----------------------
Below were the changes needed to make idl2mat work

diff idl2mat.c idl2mat.c.orig

159,160c159,160
< // if (debug) printf("%s (Matlabput) Setting name: %s\n", filename, pString);
< // mxSetName(pMat, pString); Obsolete.
---
> if (debug) printf("%s (Matlabput) Setting name: %s\n", filename, pString);
> mxSetName(pMat, pString);
163,164c163
< // engPutArray(ep, pMat); //Obsolete.
< engPutVariable(ep, pString, pMat);
---
> engPutArray(ep, pMat);
224,225c223
< // if (!(pMat = engGetArray(ep, pString))) { //Obsolete.
< if (!(pMat = engGetVariable(ep, pString))) {
---
> if (!(pMat = engGetArray(ep, pString))) {
276,277c274
< // pMat = engGetArray(ep, pString); //Obsolete.
< pMat = engGetVariable(ep, pString);
---
> pMat = engGetArray(ep, pString);
325,327d321
< if (debug) printf("(Matlabeval) Evaluating string: %s\n", pString);
<
< engOutputBuffer(ep, NULL, 0); //Disable output to avoid segmentation error.


diff Makefile Makefile.orig

< #ARCH = lnx86
< ARCH = glnx86
---
32,36c30
< # -lmi removed.
< LFLAGS = -lm -shared -L$(MATLAB)/extern/lib/$(ARCH) -leng -lmx -lmat -lut
<
< #From idl_5.4/external/call_external/C/callext_unix.txt:
< FFLAGS = -fPIC
---
> LFLAGS = -lm -shared -L$(MATLAB)/extern/lib/$(ARCH) -leng -lmx -lmat -lmi -lut
41c35
< $(CC) -o $(EXE) $(OBJS) $(LFLAGS) $(FFLAGS)
---
> $(CC) -o $(EXE) $(OBJS) $(LFLAGS)
[Message index]
 
Read Message
Previous Topic: Re: compiling itools and utilities
Next Topic: Re: find_boundary routine

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 02:05:16 PDT 2025

Total time taken to generate the page: 0.00543 seconds