using mex with variable_name(which contains file name) and with -lname switch

1 Ansicht (letzte 30 Tage)
I want to compile a .c file using mex command. file name is contained in the variable 'file'. To compile this file i have to use
mex(file);
But i also want to use the switch -lname. How to use the switch in this command

Akzeptierte Antwort

Jan
Jan am 30 Mär. 2015
Bearbeitet: Jan am 30 Mär. 2015
mex('-lmain', file);

Weitere Antworten (1)

arun kumar
arun kumar am 27 Mär. 2015
check out eval command....then you can do eval('mex(',file,')','-lname'); eval uses the value stored in a variable. i hope this is what you wanted
  2 Kommentare
Rajalakshmi Rengasamy
Rajalakshmi Rengasamy am 30 Mär. 2015
Thanks for the reply.
eval(['mex -lmain ',file])
The above command worked where 'main' is the name of the library.
Jan
Jan am 30 Mär. 2015
I strongly recommend to avoid eval. There are better solutions in every case.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by