How to Compile function in package folder?
2 次查看(过去 30 天)
显示 更早的评论
I have a folder, +crr, with a function, fast_scenario_delete.m, inside it. I would like to make fast_scenario_delete.exe. This function depends on the database toolbox and associated .jar file, and I want the output .exe file in a particular folder, so I tried:
>>mcc -m crr.fast_scenario_delete.m -o fast_scenario_delete -d ..\bin\win32 -a mysql\driver_file.jar
I get this error (in addition to other warnings that I always get):
Depfun error: 'Unable to locate crr.fast_scenario_delete.m as a function on the MATLAB path'
I tried a few other things, but they all fail because I can't add the +crr folder to the path.
For now, I have just copied the function out of the package and compiled it that way, but that really defeats the purpose of having packages. Is there a way to compile a function that is in a package folder?
3 个评论
Image Analyst
2020-4-20
You have a folder with a "+" in the folder name also? Or an extra dot in the filename?
Walter Roberson
2020-4-20
This is by design, and will not be changed.
You need to have a function that invokes the package -- just like it is not possible to directly compile a class and need to instead have a function that invokes the class.
回答(3 个)
Image Analyst
2012-1-6
That dot in crr.fast_scenario_delete.m looks strange to me. I've never tried to compile m-files with a dot in the name. Usually the m-file has the same name as the function inside it, which doesn't have a dot. Can you rename it and try it again?
What is the "Current Folder" shown in MATLAB when you execute the mcc command?
0 个评论
owr
2012-1-6
I regularly compile functions in packages - my packages consist of several classes each and the functions are methods of these classes. However, I have never tried to compile the package itself. Rather I have about 5 "regular" functions that utilize the classes in the underlying packages. These regular functions are added to a project that is deployed as a .NET dll using the Compiler and Builder NE.
This may not align with your use case but thought I'd mention it as a data point.
0 个评论
Walter Roberson
2012-1-6
You need a driver routine, even if all that driver routine does is call the package.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!