Use mex files in matlab for MAC

조회 수: 116 (최근 30일)
Rui Ascenso
Rui Ascenso 2014년 8월 25일
댓글: Walter Roberson 2019년 7월 23일
I need to use a function designed to provide ARMA-Garch-in-Mean estimation in matlab and I found a code online in a mex file. Thing is I don't know what to do next in order to use this function in matlab. I am a mac user and don't even know how to set mex files in matlab for mac. So, pretty much I need to do a ARMA-Garch-in-Mean estimation and have no clue on how to do it.
Can anyone help? What should I do?
I can give you de code or the link where I found it if it helps...
Thanks in advance, Rui

채택된 답변

Geoff Hayes
Geoff Hayes 2014년 8월 25일
Rui - it may be helpful to attach the files so that we know what you code you have. I suspect that you have at least one m-file that calls one or more MEX functions that are in C-files i.e. files with a c extension (written in the C programming language).
I have a Mac as well, and it is easy to build the MEX-functions from C/C++ as per the documentation found at the link MEX.
To setup, you need a C/C++ compiler. In the MATLAB Command Window, type
mex -setup C
What do you see? When I run this command, I observe
MEX configured to use 'Xcode with Clang' for C language compilation.
You may need to install Xcode in order to get a similar compiler. Once a compiler has been chosen, you can build the MEX-files. Change to the directory that contains the *.c files and type the command (in the MATLAB Command Window) to build the MEX-function
mex functionName.c
where functionName is the name of the function/file. You will either observe errors or see that it built successfully
Building with 'Xcode with Clang'.
MEX completed successfully.
In your folder, there will now be a file similar to functionName.mexmaci64.
Repeat the above for each C-file.
Once completed, you can call each MEX-function from within the MATLAB code as if it were a MATLAB function
% call functionName to do something
Z = functionName(A,B);
so long as you provide inputs (and assign outputs) as directed by the function signature.
Try the above and see what happens!
  댓글 수: 22
preksha pareek
preksha pareek 2019년 7월 23일
What if I dont have C file only file with extension .mexa64 is avilable?
Walter Roberson
Walter Roberson 2019년 7월 23일
You cannot use mexa64 with Mac: those are for Linux only.
There are no tools to decompile .mex* files into matlab source code.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by