Simulink data inspector report generator is an empty html

37 Ansichten (letzte 30 Tage)
Marco
Marco am 7 Jan. 2026 um 15:16
Verschoben: Walter Roberson am 25 Jan. 2026 um 9:24
Hi Guys,
i am having some trouble understanding where the issue lie.
I have a model running on fortran and a real equipment. I import the two sets of data in matlab, do some post processing to make them comparable and then i use simulink data inspector to compare them. Everything works fine, the comparison matches what i am expecting.
So until this point it works fine, but for some reason, when i attempt to generate any kind of report, i only get an empty html file.
If i follow the report generator examples with the inbuilt stock models it works.
I am not sure if the logging/streaming of signals is required in any way or if there is something else that is missing.
Below is the section of the code giving me trouble. Data is in time tables and i am converting them in time series i add to each run for the comparison.
Simulink.sdi.clear;
Simulink.sdi.view;
Simulink.sdi.setRunNamingRule("<model_name>")
run_model = Simulink.sdi.Run.create("run_model");
run_fcc = Simulink.sdi.Run.create("run_fcc");
size_model=size(model_for_comparison);
for i=1:size_model(1,2)
Simulink.sdi.addToRun(run_model,'vars',model_for_comparison(:,i));
end
size_fcc=size(excel_time_final1);
for i=1:size_fcc(1,2)
Simulink.sdi.addToRun(run_fcc,'vars',excel_time_final1(:,i));
end
pause(20);
diffResult = Simulink.sdi.compareRuns(run_fcc.ID,run_model.ID,"abstol",1,"reltol",0.05,"timetol",1);
signalMetadata = [Simulink.sdi.SignalMetaData.Run, ...
Simulink.sdi.SignalMetaData.Line, ...
Simulink.sdi.SignalMetaData.BlockName, ...
Simulink.sdi.SignalMetaData.SignalName];
Simulink.sdi.report('ReportType','Compare',"ReportOutputFile", "Compare.html");

Antworten (2)

Oliver Jaehrig
Oliver Jaehrig am 8 Jan. 2026 um 16:16
Please create a Technical Support case for that issue and if possible provide the files needed for reproduction ☺

Marco
Marco am 23 Jan. 2026 um 8:52
Verschoben: Walter Roberson am 25 Jan. 2026 um 9:24
So, techincal support provided the following answer:
In the meantime there is a workaround for you to fix the report by changing the sources. That means you can open the compare.html file and search for all "DataSource" lines. For example in line 1164 and all other lines (I have counted 6...)
Escape the inner quotes:
"DataSource1": " .AOA{:,\"\"}",
"DataSource2": " .AOA{:,\"\"}",
Or use single-quoted JS strings so the inner double-quotes don't need escaping:
"DataSource1": ' .AOA{:,""}',
"DataSource2": ' .AOA{:,""}',
As a result i created the following script to replace programatically the affected strings with the output highlighted by the support team
currentfolder=pwd;
%% replace report_name with the name of the html file created by the simulink.sdi.report command
[fidi,messagi]=fopen(append(currentfolder,'\sdireports\',report_name, '1.html'),'rt');
%% new file will be created to not modify and lose the original input
[fido,message]=fopen(append(currentfolder,'\sdireports\',report_name, '_final.html'),'wt') ;
%% the section below is useful for debuggin (e.g working in a folder with no writing rights)
if fido < 0
error('Failed to open myfile because: %s', message);
end
if fidi < 0
error('Failed to open myfile because: %s', messagi);
end
while~feof(fidi)
l=fgetl(fidi); % read line
if strfind(l,'DataSource1": " .')
% modify line here
l_temp=split(l,"\");
l2=strcat(l_temp(1,1),'\"\"}",');
l=string(l2);
end
if strfind(l,'DataSource2": " .')
% modify line here
l_temp=split(l,"\");
l2=strcat(l_temp(1,1),'\"\"}",');
l=string(l2);
end
fprintf(fido,'%s\n',string(l)); %% copy every line in the new file, including the modified ones
end
fidi=fclose(fidi);
fido=fclose(fido);

Kategorien

Mehr zu Simulink Report Generator finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by