필터 지우기
필터 지우기

Specify Path for Image in Report Generator

조회 수: 2 (최근 30일)
Matt O'Brien
Matt O'Brien 2022년 11월 25일
편집: Stephen23 2022년 11월 25일
I have a pdf generated via MatLab Report Generator. I have a few remaining issues. I have spent days trying to resolve via search of this and other forums.
I am posting each issue individually.
This issue. Specify Path for Image in Report Generator
The following line is used in an Example Report. This works and finds the image in the local directory or in a directory via the addpath function.
img1 = Image(which('ngc6543a.jpg'));
Unfortunately, I will be supplied an Excel sheet which will supply a list of images with the full image path. There may be hundreds of images and directories in the list (and the database has more than 500,000 images). I am comfortable splitting the path and filename into different variables.
Simplified file list:
'C:\Dir1\ngc6543a.jpg'
'G:\Dir2\ngc6543a.jpg'
'S:\Dir1\SubDir\ngc6543a.jpg'
When I tried the following I always get an error.
img1 = Image(which('C:\Dir1\ngc6543a.jpg'));
Please help me use the correct syntax to include the full path, eg. 'C:\Dir1\ngc6543a.jpg'.
I do not believe it is feasible to keep adding the image 'path' to the system addpath function for such high volumes.
Also... if anyone could please post a link to the Image(which)) syntax. I cannot find it.
  댓글 수: 1
Stephen23
Stephen23 2022년 11월 25일
편집: Stephen23 2022년 11월 25일
"Please help me use the correct syntax to include the full path, eg. 'C:\Dir1\ngc6543a.jpg'."
img1 = Image('C:\Dir1\ngc6543a.jpg'); % get rid of WHICH()

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2022년 11월 25일
I don't know what "Image" is. Is that your own function or a special function for the Report Generator? It's not the built-in image function because MATLAB is case sensitive.
And what's the point of using which()?
Since you already seem to have the filenames in a cell array or table because you read them in from Excel, why not simply use the index of the one you want?
[numbers, fileNames, raw] = xlsread(workbookName);
img1 = Image(fileNames{3}); % Use filename #3.
  댓글 수: 12
Matt O'Brien
Matt O'Brien 2022년 11월 25일
I found the Which documentation. https://uk.mathworks.com/help/matlab/ref/which.html
The key was to add the word function to the search parameter.
Stephen23
Stephen23 2022년 11월 25일
편집: Stephen23 2022년 11월 25일
"I cannot find any documentation for Which. I cannot find any documentation for Image."
I gave links to both of those in my previous comment, and I also explained the exact three clicks you need to find the Image documentation from the page you already were looking at. But here they are again:
I am sure that after three days reading about this topic you have already read the entire Report Generator documentation twice over, but perhaps someone else might find these screenshots useful:
"If anyone can point me to the Documentation for 'Which' and 'Image' I would really appreciate it."
Tip: practice using the documentation. Always look at what is displayed in the browser (LHS) and at the very top and bottom of every page. There is a lot of hyperlinking and a lot of information, so you have to keep your eyes open.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by