Want to add image in report from image variable in work space

4 visualizzazioni (ultimi 30 giorni)
Hi, I reall the report generator documentation and did not find any method to add the image from workspace to the report. Closest method I can get is using Figure but if I use imshow() for the figure, the image will be show to the screen. So is there any method to include image from workspace (eg, resulting from imcrop() ) to the report. Thanks

Risposte (1)

Prasanth Sikakollu
Prasanth Sikakollu il 25 Giu 2019
You can try mlreportgen.dom.Image class to append the image to the report.
Refer to the following documentation link for details.
For more information on create and format images refer to the following link.
  2 Commenti
Ahmad Irfan Abdul Wahid
Ahmad Irfan Abdul Wahid il 26 Giu 2019
This one I already take a look at but gave me no idea on how to insert image from wrokspace. The second link can be used but it will write file into the drive which would not be easier to delete the files
Paul Kinnucan
Paul Kinnucan il 26 Giu 2019
To be included in an HTML, Word, or PDF document, an image must exist as a file in your file system in a standard format such as png, jpg, svg, etc. The mlreportgen.dom.Image object allows you to add existing image files to a report. If an image resided in the MATLAB workspace, i.e., the computer's main memory, the image must be copied to disk before it can be included in a report.
The MATLAB print command allows you to copy some common types of MATLAB images, such as figures and Simulink diagrams, from main memory (i.e., the MATLAB workspace) to image files. It requires only a few lines in a MATLAB script to create such files, wrap them in Image objects, include them in a report, and delete the files.
The Report Generator's mlreportgen.report.Figure reporter does all this work for you for figures, including printing the figure, wrapping the image file in an Image object, adding the Image object to a report, and deleting the image file.
import mlreportgen.report.*
rpt = Report('CroppedImage', 'pdf');
I = imread('circuit.tif');
I2 = imcrop(I,[60 40 100 90]);
f = figure;
imshow(I2)
add(rpt, Figure(f));
close(rpt);
delete(f);
rptview(rpt);
See
for more information.

Accedi per commentare.

Categorie

Scopri di più su MATLAB Report Generator in Help Center e File Exchange

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by