From: Knut on
I want to have a script compile my mex file using different options depending on what compiler is set up. Passing switches seems more flexible than editing mexopts.bat and having several versions. This seems to work just fine from the command-prompt, but when I make a script/function that does the same, I get a strange error.

cc = mex.getCompilerConfigurations
if strcmp(cc.Details.CompilerExecutable, 'icl')% using Intel compiler
mex -v OPTIMFLAGS="$OPTIMFLAGS /O3 /DNDEBUG" hello.c
else
mex hello.c
end

??? Error: File: buildmex.m Line: 3 Column: 5
"mex" was previously used as the prefix of a compound name,
conflicting with its use here as the name of a function.
From: James Tursa on
"Knut " <knut.inge.hvidsten(a)tandberg.com> wrote in message <hlh089$jtc$1(a)fred.mathworks.com>...
> I want to have a script compile my mex file using different options depending on what compiler is set up. Passing switches seems more flexible than editing mexopts.bat and having several versions. This seems to work just fine from the command-prompt, but when I make a script/function that does the same, I get a strange error.
>
> cc = mex.getCompilerConfigurations
> if strcmp(cc.Details.CompilerExecutable, 'icl')% using Intel compiler
> mex -v OPTIMFLAGS="$OPTIMFLAGS /O3 /DNDEBUG" hello.c
> else
> mex hello.c
> end
>
> ??? Error: File: buildmex.m Line: 3 Column: 5
> "mex" was previously used as the prefix of a compound name,
> conflicting with its use here as the name of a function.

The error is not strange at all. You have created a variable called mex that has the same name as a built in function. Don't do that. Rename your mex variable to something else.

James Tursa
 | 
Pages: 1
Prev: Inconsistency coefficient
Next: v4 INTERPOLATION