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:
using mex

Subject: using mex

From: james bejon

Date: 1 Dec, 2010 11:10:22

Message: 1 of 5

Dear All,

I'm trying to use Matlab's mex facility, ultimately so that I can pass and receive arguments from C++ routines. I was hoping someone could tell me where I might be going wrong.

Following the advice on http://www.mathworks.com/support/tech-notes/1600/1605.html#intro, my first step was

>> mex -setup
Warning: DOS programs may not execute correctly when the current directory is a UNC pathname.
> In mex_helper at 52
  In mex at 216
'\\SD1FILEPW11\USERS\JBEJON\MATLAB'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
Please choose your compiler for building external interface (MEX) files:
 
Would you like mex to locate installed compilers [y]/n? y
 
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2009a\sys\lcc
 
[0] None
 
Compiler: 1
 
Please verify your choices:
 
Compiler: Lcc-win32 C 2.4.1
Location: C:\PROGRA~1\MATLAB\R2009a\sys\lcc
 
Are these correct [y]/n? y




But then when I try

>> mex yprime.c

I get

Warning: DOS programs may not execute correctly when the current directory is a UNC pathname.
> In mex_helper at 52
  In mex at 216
'\\SD1FILEPW11\USERS\JBEJON\MATLAB'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
 
  C:\PROGRA~1\MATLAB\R2009A\BIN\MEX.PL: Error: 'yprime.c' not found.
 
??? Error using ==> mex at 218
Unable to complete successfully.
 
(and mex 'C:\Program Files\MATLAB\R2009a\extern\examples\mex\yprime.c' is the same)



By the way,

>> matlabroot

ans =

C:\Program Files\MATLAB\R2009a




I tried following the 'troubleshooting' section in the same link, but I still couldn't sort it out. Does anyone have any ideas as to what the issue is here please?

Subject: using mex

From: Aurelien Queffurust

Date: 1 Dec, 2010 12:42:04

Message: 2 of 5

"james bejon" <jamesbejon@yahoo.co.uk> wrote in message <id5aeu$3k6$1@fred.mathworks.com>...
> Dear All,
>
> I'm trying to use Matlab's mex facility, ultimately so that I can pass and receive arguments from C++ routines. I was hoping someone could tell me where I might be going wrong.
>
> Following the advice on http://www.mathworks.com/support/tech-notes/1600/1605.html#intro, my first step was
>
> >> mex -setup
> Warning: DOS programs may not execute correctly when the current directory is a UNC pathname.
> > In mex_helper at 52
> In mex at 216
> '\\SD1FILEPW11\USERS\JBEJON\MATLAB'
> CMD.EXE was started with the above path as the current directory.
> UNC paths are not supported. Defaulting to Windows directory.
> Please choose your compiler for building external interface (MEX) files:
>
> Would you like mex to locate installed compilers [y]/n? y
>
> Select a compiler:
> [1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2009a\sys\lcc
>
> [0] None
>
> Compiler: 1
>
> Please verify your choices:
>
> Compiler: Lcc-win32 C 2.4.1
> Location: C:\PROGRA~1\MATLAB\R2009a\sys\lcc
>
> Are these correct [y]/n? y
>
>
>
>
> But then when I try
>
> >> mex yprime.c
>
> I get
>
> Warning: DOS programs may not execute correctly when the current directory is a UNC pathname.
> > In mex_helper at 52
> In mex at 216
> '\\SD1FILEPW11\USERS\JBEJON\MATLAB'
> CMD.EXE was started with the above path as the current directory.
> UNC paths are not supported. Defaulting to Windows directory.
>
> C:\PROGRA~1\MATLAB\R2009A\BIN\MEX.PL: Error: 'yprime.c' not found.
>
> ??? Error using ==> mex at 218
> Unable to complete successfully.
>
> (and mex 'C:\Program Files\MATLAB\R2009a\extern\examples\mex\yprime.c' is the same)
>
>
>
> By the way,
>
> >> matlabroot
>
> ans =
>
> C:\Program Files\MATLAB\R2009a
>
>
>
>
> I tried following the 'troubleshooting' section in the same link, but I still couldn't sort it out. Does anyone have any ideas as to what the issue is here please?



It is the expected behavior.
As specified in the MATLAB doc:
  Running dos with a command that relies upon the current folder FAILS when the current folder is specified using a UNC pathname.
The link :
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/dos.html

Aurélien,
http://blog.developpez.com/matlab4geek/

Subject: using mex

From: Steven_Lord

Date: 1 Dec, 2010 15:07:44

Message: 3 of 5



"james bejon" <jamesbejon@yahoo.co.uk> wrote in message
news:id5aeu$3k6$1@fred.mathworks.com...
> Dear All,
>
> I'm trying to use Matlab's mex facility, ultimately so that I can pass and
> receive arguments from C++ routines. I was hoping someone could tell me
> where I might be going wrong.
>
> Following the advice on
> http://www.mathworks.com/support/tech-notes/1600/1605.html#intro, my first
> step was
>
>>> mex -setup
> Warning: DOS programs may not execute correctly when the current directory
> is a UNC pathname.
>> In mex_helper at 52
> In mex at 216
> '\\SD1FILEPW11\USERS\JBEJON\MATLAB'

Map a network drive to this UNC path (or some parent directory of this
directory) and make that network drive your current directory. If you're
not sure how to do that, you could also move your files into a non-UNC path
(like c:\temp) and MEX them from there, or search microsoft.com for "map
network drive <your version of Windows>" for instructions.

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

Subject: using mex

From: james bejon

Date: 1 Dec, 2010 15:23:20

Message: 4 of 5

Thanks to both of you for your help. That's working now. So, all I need to do is download something that compiles C++. Do you have any recommendations?

Subject: using mex

From: Steven_Lord

Date: 1 Dec, 2010 15:45:01

Message: 5 of 5



"james bejon" <jamesbejon@yahoo.co.uk> wrote in message
news:id5p98$hmd$1@fred.mathworks.com...
> Thanks to both of you for your help. That's working now. So, all I need
> to do is download something that compiles C++. Do you have any
> recommendations?

One of the supported compilers for your release:

http://www.mathworks.com/support/compilers/R2010b/index.html

Note that this page is for the latest release, release R2010b; if you're
using an older release make sure you go to the appropriate page for your
release using the links on the left side of the page.

--
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