Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: How to re-build mex from files generated from coder?

$
0
0

>
> You said that in order to create mex file from your testfunc_mex.c, you needed to run testfunc_mex.bat. I didn't understand this part. Do you run it outside matlab prior to mex command? Could you, please, elaborate on that? Sorry if my question may seem naive.
>
> Thank you
> Valery

Hi Valery

Usually when we create .mex files, we are told that we should write C code (.c file) and then in matlab command window, we would use the command "mex filename.c", this will produce .mex file.

However, the .c files created by the coder doesn't behave like this. As I wrote above, if I try "mex testfunc_mex.c", then it will yield error and doesnt produce .mex file.

In order to produce .mex file from .c files generated from coder. We must find and run testfunc_mex.bat (alsop generated by the coder), under windows. This .bat is bit of a magical black box to me, and it will create .mex file. (after using coder, there is already a .mex file created, to test this testfunc_mex.bat works, you can delete the original .mex file, and you'll see, after you run testfunc_mex.bat, a new .mex file is generated somewhere inside the folder). (This also mean, you will never need to run "mex" function inside matlab at any point)

-sida

Viewing all articles
Browse latest Browse all 19628

Trending Articles