Use mex files in matlab for MAC

114 次查看(过去 30 天)
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