How to add module tabs in each section in HTML file using mlreportge​n.report.H​TMLModuleT​abs ?

4 Ansichten (letzte 30 Tage)
I am getting error while adding module tabs in second section (second function ->fun2()) of the html-file.
import mlreportgen.report.*;
import mlreportgen.dom.*;
%create a output folder for report
mkdir output;
outPath = fullfile(pwd,'output','HTML_Report');
%report name
rpt = Report(outPath, 'html-file');
%open report
open(rpt);
toc = TableOfContents;
toc.Title = Text('Contents');
append(rpt, toc);
%title
tp = TitlePage('Title', 'KPI Summary',...
'subtitle', 'Post Processing and Analysis Report');
append(rpt, tp);
%first function
fun1(rpt);
%Second function
fun2(rpt);
No matching constructor found for superclass 'mlreportgen.dom.LockedDocumentPart'.

Error in mlreportgen.report.internal.DocumentPart

Error in mlreportgen.report.HTMLModuleTabs/getTabsLabelArea

Error in mlreportgen.report.ReportForm/fillHole

Error in mlreportgen.report.ReporterBase/processHole

Error in mlreportgen.report.ReportForm/fillForm

Error in mlreportgen.report.ReporterBase/getDocumentPart

Error in mlreportgen.report.ReporterBase/getImpl

Error in mlreportgen.report.HTMLModuleTabs/getImpl

Error in mlreportgen.report.internal.LockedForm.add

Error in mlreportgen.report.ReportBase/append

Error in solution>fun2 (line 48)
append(rpt, modTabsObj);
close(rpt);
Now, I add one section in fun1 added moduletabs which is working fine.
function fun1(rpt)
import mlreportgen.report.*;
import mlreportgen.dom.*;
t = mlreportgen.dom.Table(magic(2));
labels = 'table 1.0';
content = t;
tabsdata = struct('Label',labels,'Content',content);
modTabsObj = mlreportgen.report.HTMLModuleTabs('TabsData',tabsdata);
s1 = Section('Physical_Configuration');
append(s1, Section('Radio Configuration'));
append(rpt, modTabsObj);
add(rpt, s1);
end
Now, in second function error seen while adding another moduleTabs.
function fun2(rpt)
import mlreportgen.report.*;
import mlreportgen.dom.*;
t = mlreportgen.dom.Table(magic(3));
labels = 'table 2.0';
content = t;
tabsdata = struct('Label',labels,'Content',content);
modTabsObj = mlreportgen.report.HTMLModuleTabs('TabsData',tabsdata);
s1 = Section('Measurements');
append(s1, Section('Plots'));
append(rpt, modTabsObj);
add(rpt, s1);
end
When I comment fun2, code run successfully but with fun2 I got error.
Please help me if anyone knows how to add moduleTabs in each section?

Antworten (1)

Kannan
Kannan am 28 Sep. 2022
Please go through the following code (Lines 45 and 48 are modified) to check if the error still persists and that you are able to add multiple module tabs to the report.
import mlreportgen.report.*;
import mlreportgen.dom.*;
%create a output folder for report
mkdir output;
outPath = fullfile(pwd,'output','HTML_Report');
%report name
rpt = Report(outPath, 'html-file');
%open report
open(rpt);
toc = TableOfContents;
toc.Title = Text('Contents');
append(rpt, toc);
%title
tp = TitlePage('Title', 'KPI Summary',...
'subtitle', 'Post Processing and Analysis Report');
append(rpt, tp);
%first function
fun1(rpt);
%Second function
fun2(rpt);
close(rpt);
function fun1(rpt)
import mlreportgen.report.*;
import mlreportgen.dom.*;
t = mlreportgen.dom.Table(magic(2));
labels = 'table 1.0';
content = t;
tabsdata = struct('Label',labels,'Content',content);
modTabsObj = mlreportgen.report.HTMLModuleTabs('TabsData',tabsdata);
s1 = Section('Physical_Configuration');
append(s1, Section('Radio Configuration'));
append(rpt, modTabsObj);
add(rpt, s1);
end
function fun2(rpt)
import mlreportgen.report.*;
import mlreportgen.dom.*;
t = mlreportgen.dom.Table(magic(3));
labels = 'table 2.0';
content = t;
tabsdata = struct('Label',labels,'Content',content);
%modTabsObj = mlreportgen.report.HTMLModuleTabs('TabsData',tabsdata);
s1 = Section('Measurements');
append(s1, Section('Plots'));
%append(rpt, modTabsObj);
add(rpt, s1);
end
  1 Kommentar
Neetesh Kumar Sharma
Neetesh Kumar Sharma am 28 Sep. 2022
Hi Kannan,
You commented Line (45 and 48) due to which code is running without any error but the ModuleTabs only get created in section 1 (table 1.0). I want another tab in section 2 which is not getting created as you can see in below html ouptu file. In Fun2(), table 2.0 should be displayed as tabs in section 2.
So, code is running but it didn't solve my problem yet.
Please help if any other way to add separate ModuleTabs in each section.
Thanks
Neetesh

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by