Main Content

getReporter

Class: slreportgen.finder.ModelVariableResult
Namespace: slreportgen.finder

Get reporter for model variable search result

Syntax

reporter = getReporter(variableResult)

Description

reporter = getReporter(variableResult) returns an slreportgen.report.ModelVariable object for a model variable search result.

Input Arguments

expand all

Result of a search using the find or next method of an slreportgen.finder.ModelVariableFinder object.

Output Arguments

expand all

Reporter that includes information about a model variable in a report. Customize the content and formatting of the information for a variable by setting properties of the reporter.

Examples

expand all

Customize the formatting of a model variable in a report by setting the reporter properties.

% Create a Report
rpt = slreportgen.report.Report("MyReport","pdf");

% Create a Chapter
chapter = mlreportgen.report.Chapter();
chapter.Title = "Model Variable Reporter Example";

% Load the model
model_name = "sf_car";
load_system(model_name);

% Find the variables in the model
finder = slreportgen.finder.ModelVariableFinder(model_name);

while hasNext(finder)
    result = next(finder);
    
    % Get the ModelVariable reporter for the result
    % Customize the formatting of numbers
    reporter = getReporter(result);
    reporter.NumericFormat = "%.4f";
    
    % Add the reporter to the chapter
    add(chapter,reporter);
end
% Add chapter to the report
add(rpt,chapter);

% Close the report and open the viewer
close(rpt);
rptview(rpt);

Version History

Introduced in R2019b