How to Compile function in package folder?

2 Ansichten (letzte 30 Tage)
Steve
Steve am 6 Jan. 2012
Kommentiert: Walter Roberson am 20 Apr. 2020
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 Kommentare
Image Analyst
Image Analyst am 20 Apr. 2020
You have a folder with a "+" in the folder name also? Or an extra dot in the filename?
Walter Roberson
Walter Roberson am 20 Apr. 2020
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.

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Image Analyst
Image Analyst am 6 Jan. 2012
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?

owr
owr am 6 Jan. 2012
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.

Walter Roberson
Walter Roberson am 6 Jan. 2012
You need a driver routine, even if all that driver routine does is call the package.

Kategorien

Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by