How can I compile a live script exporter?
9 次查看(过去 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!