How to compile functions that are in a package folder (i.e. has the + prefix)?

2 ビュー (過去 30 日間)
Jessee
Jessee 2018 年 6 月 28 日
コメント済み: Jessee 2018 年 7 月 2 日
I have MATLAB code that has been organized into namespaces, +myPackage/myFunction.m. When I try to compile this function to a Java Package with Compiler SDK (2018a) app, I get an error with the following log file:
mcc -W 'java:myNamespace,myClass' -T link:lib -d C:\path_to_project\my_proj\for_testing class{learn:C:\path_to_project\+myPackage\myFunction.m}
Could not determine type of the MATLAB file 'myFunction.m'. Please make sure that you are compiling MATLAB Program files.

採用された回答

Matthew Esch
Matthew Esch 2018 年 7 月 2 日
編集済み: Matthew Esch 2018 年 7 月 2 日
Good Morning Jessee,
This is a known limitation our developers are considering for a future release. MATLAB files in packages can be compiled successfully as dependencies, however they cannot be used as exported functions. I apologize for the inconvenience this has caused.
Consider moving the functions you want to compile to another non-package folder. Alternatively, if the "main" file you would like to compile is in the package:
  1. Create a new script outside of any package directories
  2. Call the package function from the new script (>> mypackage.myfile)
  3. Select the new script as the main compilation file.
If you want to access a function through Namespace in deployed Java package, instead of putting MATLAB functions in packages you can leverage "deploytool". It has the capability to generate Java Libraries with a specific namespace.
  1 件のコメント
Jessee
Jessee 2018 年 7 月 2 日
Creating a wrapper main file that is outside of a package folder worked for me. I liked that solutions best since it didn't require modifying the code that is inside the package.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB Compiler SDK についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by