assignin function does not work from export function

조회 수: 5 (최근 30일)
Tobias Panitz
Tobias Panitz 2022년 10월 12일
댓글: Walter Roberson 2024년 8월 19일
Hello.
We're using the export function to run an *.mlx file and then export it to a pdf.
I don't seem to be able to interact with the OS filesystem or store data in the base workspace when the *.mlx is executed using the export function
export("Analyse_Template",filename,PageSize="A4",Run=true,FigureResolution=800,HideCode=true);
% using assignin does not work
assignin('base','OutPutTable',OutPutTable)
% using writetable does not work
writetable(inputTable, FName,"WriteMode","append");
Executing the *.mlx file itself produces the desired results.
Why can I not work outside of the scope of the export function?
Many thanks in advance.

답변 (1개)

arushi
arushi 2024년 8월 16일
Hi Tobias Panitz
I encountered a similar issue when using the live script, but when I ran the code in a .m file instead of “. mlx” file, it executed just fine.
Hope this helps.
  댓글 수: 2
Tobias Panitz
Tobias Panitz 2024년 8월 19일
So you executed the *.mlx from a m-file?
Walter Roberson
Walter Roberson 2024년 8월 19일
That just might work. When you invoke a .mlx from inside a .m, the matlab part of the code gets extracted from the mlx and then executed. This is different than how .mlx are executed normally.

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

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by