Use mex files in matlab for MAC

113 ビュー (過去 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 Center および File ExchangeWrite 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