Inconsistent Invalid Image path error in Report Generator
1 view (last 30 days)
Show older comments
I am using Matlab R2016a. I am attempting to generate a template Direct PDF report however, I am getting inconsistent results when specifying custom directories. Report generation works when I run it from a code repo for development (directory set to present working directory), but sometimes fails when I change the report file location to a "custom directory". The error message "Invalid Image Path" is thrown. The path indicated in the error message is indeed not the correct path to the image files. It is searching for the images in the "...\Custom_Directory\" and not "...\Custom_Directory\filename_pdf_files". But as I mentioned, it is inconsistent, as sometimes it searches for the images in the correct location, and sometimes not. For instance if I change the custom directory to:
C:\Users\Username\Documents
The report generates without error and finds the images folder. But if I change it to:
C:\Users\username\Documents\test
It searches for the images in "C:\Users\username\Documents\test" instead of "C:\Users\username\Documents\test\filename_pdf_files", and therefore throws an error.
Additionally, if I set the custom directory to my repo location, again it works and finds the image files. Any help sorting this out would be greatly appreciated.
3 Comments
Rinnah Chikosi
on 19 Jul 2020
You need to add the images folders to your matlab file path.
To do this got to the home tab > in the environment section, select "set path", and add the folder to make it part of your file path.
Answers (0)
See Also
Categories
Find more on File Operations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!