MATLAB Report Generator | ![]() ![]() |
Editing execute.m to Insert Text Output into the Report
Edit the execute.m
file to create a figure, plot random lines in the figure's axes, and insert the handle to the figure (text output) into the report.
To complete this task, replace the default lines of code with the following lines of code (comments are optional).
%EXECUTE returns a report element during generation function out=execute(c) %Create the figure. figHandle=figure('Name',c.att.Plot_Title); %Create the axes and make them a child of the figure. %Set the axes "Color" property to be the value of %the AxesColor attribute. axHandle=axes('Parent',figHandle); %This creates the data to be plotted %and displays it in the axes. The %number of lines to be plotted is %defined by the NumLines property. plotData=rand(10,floor(c.att.NumLines)); plot(plotData,'Parent',axHandle); %By setting 'out' to the figHandle variable, %we will insert the figure handle into the report. out=figHandle %Clean up by deleting the figure delete(figHandle)
![]() | Editing the Execute Method | Using the New Component | ![]() |