App Compiler Additional Settings - Log File with unique name

조회 수: 4 (최근 30일)
Marius Mueller
Marius Mueller 2023년 1월 30일
편집: Mario Malic 2023년 1월 30일
Hi Community,
I am running R2021a and I ran into an issue when compling a stand alone app:
How do I define a Log File for app output during app compilation where the name of the log file contains a unique string (e.g. current date and time) ?
Sadly the documentation on this setting is very frank (Package MATLAB programs for deployment as standalone applications - MATLAB - MathWorks Deutschland: "Check the appropriate boxes if you don't want a command window to show up during execution or if you want a log file to be created.").
Any ideas would be appreciated.
Kind Regards
Marius

답변 (1개)

Mario Malic
Mario Malic 2023년 1월 30일
Hey,
you can do the compiling manually in the script or command window using mcc function in which you can supply the log filename.
  댓글 수: 2
Marius Mueller
Marius Mueller 2023년 1월 30일
Hey,
thank you for the fast reply!
To clearify:
The log file name should be unique with respect to app usage -> the file name should change dynamically everytime the app is used. Otherwise each usage would overwrite the log file.
Mario Malic
Mario Malic 2023년 1월 30일
편집: Mario Malic 2023년 1월 30일
Oh, I got it now.
From help:
-R Specify a log file name. The file is created in the application folder at runtime and contains information about MATLAB Runtime initialization and all text piped to the command window.
I am not sure if this is correct, when I tried to compile it in this way and ran the app afterwards
eval(sprintf("mcc %s", sprintf("-R '-logfile, '%s'' -o App -W 'main:App,version=1.0' -T link:exe -d 'obfuscated/App/for_testing' -v 'obfuscated/App.mlapp' -r 'C:/Program Files/MATLAB/R2022b/toolbox/compiler/packagingResources/default_icon.ico'", strrep(strrep(string(datetime), {':'}, ''), {' '}, ''))))
the log file name always had the time when the app was compiled, maybe I did something wrong.
Also, the -M option seems interesting but is for some reason ignored when compiling standalone.
TLDR: I would suggest to do the logging with the diary function.

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

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by