How can I access the name, path, extension or format of the report being generated in MATLAB Report Generator 3.2.1 (R2007b)?

1 view (last 30 days)
I am creating a report in MATLAB Report Generator and would like to know how I can include the name, path, extension and format of the current report being generated.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 19 Dec 2009
In order to include this information in a report you will need to write a custom component that extracts this data from the XML structure which is used when the document is generated. The execute() function of the report should contain the following code:
function out=execute(thisComp,parentDoc,varargin)
% Find root of report object
root = thisComp;
while ~isempty(root.getParent)
% We have not arrived at the top level yet, so go up once more
root = root.getParent;
end
% Get the current report
report = root.getCurrentRpt;
% Obtain data from report object
keyboard
[p,n,e] = fileparts(report.getChunkFileName);
% The filename of the report
reportName = n;
% The extension of the report
reportExtension = e;
% The directory name in which the report is generated
reportDirectory = report.getrptname;
% The format of the report
outputformat = report.getPropValue('Format');
% Add something useful here to out before quitting
out =[];

More Answers (0)

Products


Release

R2007b

Community Treasure Hunt

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

Start Hunting!