필터 지우기
필터 지우기

How can I set the destination directory for a created report using report generator in a compiled app?

조회 수: 1 (최근 30일)
I have a compiled app that uses Report Generator to output report pages. The code runs well in the Matlab environment, but in the compiled app, the user must run as admin to have write permission to Program Files (where the app is installed). I'm using the document command as shown in the code below.
makeDOMCompilable();
import mlreportgen.report.*
import mlreportgen.dom.*
%user enters file name in dialogue window
prompt = {'Enter File Name:'};
dlgtitle = 'Input';
dims = [1 35];
definput = {''};
Filename = inputdlg(prompt,dlgtitle,dims,definput);
Filename = string(Filename);
%user selects appropriate template file
[templatename, pathname] = uigetfile({'*.dotx'}, 'File Selector');
template = strcat(pathname, templatename);
% output document is created - trying to modify the code below
% to allow the user to select the directory where this file is
% created
D = Document(Filename,'docx', template);
The user inputs a file name via a dialogue box, selects the appropriate template file, and the document command creates the output file. My end users will not be able to run as admin. Is there a way to set (or have users input/select) the directory to create the output report in a directory where they'll have write permission?
  댓글 수: 3
Mario Malic
Mario Malic 2023년 12월 20일
편집: Mario Malic 2023년 12월 20일
I would suggest to write the data within the TEMP or HOME environment variable, you will have write permissions there. Above works as well.

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by