Why do I receive an error message - 'Specified key not found in container' - when running a MATLAB function after generating code for it using MATLAB Coder?

10 views (last 30 days)
I am generating code for a MATLAB script using MATLAB Coder and this generates a MEX file. I find that the code generation is successful, but when I go back to run the script, I receive an error that says - 'Specified key not found in container'. Why does this happen?
 

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 23 Sep 2016
This error occurred due to the incorrect compilation of the MEX file. In this case, because the original '.M' function was shadowed by the corresponding MEX file, calling the function resulted in the execution of the MEX file and led to the observed error. To resolve the error, perform the following steps:
1. Enter the following command in the Command window to locate the MEX file:
              which -all <mexfilename>.<mexfile-extension>
              NOTE - The <mexfile-extension> can be obtained by entering the "mexext" command at the MATLAB Command Window.
2.  This command will output the path to the MEX file if it still exists. Navigate to the location of the MEX file and delete it.
3.  Restart MATLAB and try running the function again. An alternative to restarting MATLAB would be to enter the command - 'clear mex' at the Command Window and then try running the function again. 

More Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!