How to Compile function in package folder?

조회 수: 4 (최근 30일)
Steve
Steve 2012년 1월 6일
댓글: Walter Roberson 2020년 4월 20일
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
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
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
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?

owr
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.

Walter Roberson
Walter Roberson 2012년 1월 6일
You need a driver routine, even if all that driver routine does is call the package.

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by