how to generate MEX from package function in MATLAB?

5 views (last 30 days)
I have the following directory structure:
and so forth.
I have a function under `+model` directory called `run` that depends on some functions in the `+options` directory, such that my `main.m` script under directory `main` calls `` and the function `run` calls some `options.opt()`.
I want to generate a MEX file of ``, so I run the `coder` from MATLAB command prompt, and on the first screen, where I enter the function name to generate code for, I type
and the coder simply displays the error:
This file is shadowed by C:\....\main\+model\run.m
I already tried adding the `main` directory to the path, but it didn't work.
  • Is it even possible to compile a MEX for any package function, such as `` in this scenario?
MATLAB version: ' (R2018a)'
  1 Comment
Walter Roberson
Walter Roberson on 17 Mar 2019
Perhaps if you create a new function that just calls and ask to generate code for the new function ?

Sign in to comment.

Accepted Answer

David Fink
David Fink on 19 Mar 2019
Functions within packages are not supported as entry-point functions. (Current as of R2018b)
See the following question/answer with workarounds (including the one described by Walter on this question):

More Answers (0)


Find more on MATLAB Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!