Creating log file for Matlab compiler's created executable
이전 댓글 표시
Hi I am using matlab compiler to compile an application. I want to create a logfile when its executed. Everything works fine, and logfile is created and information from the Matlab command prompt is added to it as well. What if I want to use a variable logfile name, such as using current date and time as a part of the filename. To be specific, I want to use:
datestr(clock,30)
as a part of the name so that a filename such as:
mylogfile_20170428T101532.log
is created. The way to create fixed name logfile at run time is to specify it at the compile time:
mcc -R '-logfile, filename.log' ..........
Using strcat options for variable filename such as:
mcc -R strcat('''-logfile,DotCodeReader_',datestr(clock,30),'.log''')
Don't work. I don't want to use the diary option of creating a logfile since diary created logfile appears empty until the executable is stopped.
Any suggestions, please?
Best Regards
Wajahat
답변 (2개)
Prannay Jain
2017년 5월 1일
You probably cannot provide the variable in the logfile name while using 'mcc'. As a workaround, create an expression of the mcc command where you use the filename variable and call this expression in eval.
>> filename = ['mylogfile_', datestr(clock,30), '.log']
>> exp = ['mcc -m test.m', ' -R ''-logfile,', filename, '''']
>> eval(exp);
댓글 수: 2
Walter Roberson
2017년 5월 1일
That cannot help relative to the option of using mcc as a function passing in variables like Wajahat Kazmi showed.
Wajahat Kazmi
2017년 5월 3일
편집: Wajahat Kazmi
2017년 5월 3일
Jan
2017년 5월 1일
Do you mean:
filename = ['mylogfile_', datestr(clock,30), '.log'];
mcc('-R', '-logfile', filename)
?
카테고리
도움말 센터 및 File Exchange에서 Deploy to C++ Applications Using mwArray API (C++03)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!