How can I compile a live script exporter?

8 ビュー (過去 30 日間)
Ben Brust
Ben Brust 2022 年 1 月 7 日
回答済み: Martin Knelleken 2022 年 1 月 27 日
I have created a live script export function with the help of this answer and I want to compile it into an executable.
It compiles into an exe, but when trying to execute I receive an error. I imagine it occurs because I am calling an internal function.
Is there a way I can get around this limitation?
The intention for this is to allow other applications such as Git view a text representation of live scripts.
Here's the very simple function which works well from MATLAB:
function mlxToLaTeX(mlxFilePath)
% Description:
% Function to convert a *.mlx file to LaTeX format text and display in
% the command window.
%
% Compile by running:
% mcc('-m', '-d', pwd, 'mlxToLaTeX.m');
%
% *************************************************************************
% Examples:
% mlxToLaTeX('someScript.mlx');
%
% See also matlab.internal.liveeditor.openAndConvert
tmpFile = sprintf('%s.tex', tempname);
matlab.internal.liveeditor.openAndConvert(mlxFilePath, tmpFile);
texCode = fileread(tmpFile);
delete(tmpFile);
fprintf('%s',texCode);
But when compiled, I recieve the following output:
!mlxToLaTeX someScript.mlx
Unable to resolve the name matlab.internal.liveeditor.openAndConvert.
Error in mlxToLaTeX (line 31)
MATLAB:undefinedVarOrClass
MATLAB version: 2019b
Thank you,
Ben

採用された回答

Martin Knelleken
Martin Knelleken 2022 年 1 月 27 日
Hi Ben,
Thank you for using the Live Editor and for bringing this up!
Indeed, matlab.internal.liveeditor.openAndConvert is not supported by the MATLAB complier. You should have seen warnings while running the compiler already. Something like: 'The file or function has been excluded from packaging for the "MCR" target environment'. One reason is that this is an internal function which is not made for public use and therefore it's not neccessarily supposed to work with the compiler.
We're actively working on a public replacement for openAndConvert. I can't promise that the first version of that will be fully supported by the compiler but we'll definitively attach importance to that.
Thanks
- Martin

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInstall Products についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by