How can I compile a live script exporter?
8 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Install Products についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!