필터 지우기
필터 지우기

Programmatically run and export live script

조회 수: 63 (최근 30일)
Joachim Vandekerckhove
Joachim Vandekerckhove 2016년 5월 6일
편집: 刘 成 2022년 3월 19일
I have a set of live scripts that I can save as html and publish for a client to inspect. Right now, I do that by opening one script at a time, hitting F5, and then clicking Save As >> html to save it. I'd like to automate that process. I was hoping publish('script.mlx','html') would work, but it doesn't seem to. I can save the *.mlx as .m and publish that, but it changes the layout and formatting, and I'd like to keep those.

채택된 답변

Baptiste Ottino
Baptiste Ottino 2017년 8월 7일
Hi, I'm late to the party, but I spent hours and hours on this issue, and by pure luck I just found the answer. So in hope someone reads this, here is the function you are looking for. It certainly is the one called by the "Save As" button.
doc matlab.internal.richeditor.openAndConvert
Best regards.
  댓글 수: 13
Andrew Janke
Andrew Janke 2021년 4월 21일
You da bomb! This helped me out a lot.
Harry van der Pol
Harry van der Pol 2022년 1월 9일
편집: Harry van der Pol 2022년 1월 9일
As an addition to the answer of Jesse Desterro
In stead of using strcat, use the function fullfile to make the script run as well on Window like systems as on Unix systems. So instead of
mlxloc = strcat(pwd,'\filename.mlx');
use
mlxloc = fullfile(pwd,'filename.mlx');

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

刘 成
刘 成 2022년 3월 19일
편집: 刘 成 2022년 3월 19일
NOW, we can use export introduced in MATLAB R2022a.
export("myscript.mlx")
NOTE: if run this in GITHUB hosted runner, some problem may happen

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by