- Save the image as a jpg image.
- Rotate the image 90 degrees using the imrotate function--requires the MATLAB Image Processing Toolbox or your own rotate function (see image rotation examples)
- Save the rotated image.
- Wrap the rotated image in a DOM Image object.
- Save your report's current page layout.
- Append a landscape page layout to your report.
- Append the rotated image object to your report.
- Clone your original page layout.
- Append the cloned page layout to restore your report's original page layout.
Report Generator Image Rotation
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi, I'm trying to write a code which saves matlabfigures as jpg-images and imports it afterwards into the report content to create a PDF. My problem is that some of these images need to be rotated 90 degrees. I'm writing the code programatically not using the reportgenerator interface. Here is my the important part of my code:
saveas(gcf,'Daten/Report/Plot4.jpg');
Plot4_Image = Image('Daten/Report/Plot4.jpg');
Plot4_Image.Style = {ScaleToFit, PaperOrientation(Landscape)};
append(Report,Plot4_Image);
Of course this is throwing an error because there is no attibute Paperorientation for mlreportgen.dom.image.style but you get the idea what i wanna do. It semms like this should be a simple task but i just can't get the hang of it. I want the image to be rotated + 90° and fill a whole page in the PDF. I've looked into changing the orientation when the image is first saved as well but it seems like saveas has the default orientation portrait and i don't really wanna change the code of it because for all the other images portrait is fine.
Hope someone can help me!
Cheers Yannick
댓글 수: 0
답변 (1개)
Paul Kinnucan
2017년 2월 14일
Rotating an image and printing it on a landscape page in your report is doable but not easy. Here is a recipe:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Images, Figures, Axes, Equations, MATLAB Code, and MATLAB Variables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!