Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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 Kommentare
Mario Malic
Mario Malic am 20 Dez. 2023
Bearbeitet: Mario Malic am 20 Dez. 2023
I would suggest to write the data within the TEMP or HOME environment variable, you will have write permissions there. Above works as well.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by