フィルターのクリア

How to add a .png image to be published as a pdf output file

20 ビュー (過去 30 日間)
NeGM
NeGM 2021 年 10 月 21 日
回答済み: Ricardo 2024 年 6 月 8 日
Hi everyone,
Im trying to add an image to my document but I keep getting an error
[ERROR] FOUserAgent - Image not found. URI: file:///Part1.jpg. (See position -1:-1)
[ERROR] FOUserAgent - Image not found. URI: file:///Part1.jpg. (No context info available)
my code is the following:
%% 1. System Description
%
% <<Part1.png>>
%
I have my image in the same folder as my .m file. Any help is appreciated. Thank you in advance!

回答 (4 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 10 月 21 日
Note the file extension - Part1.jpg
That looks like that in your code the file extension is NOT *.png but *.jpg
Your image file extension is *.png
  1 件のコメント
NeGM
NeGM 2021 年 10 月 21 日
Hi, I actually had both files in my folder
1- Part1.jpg
2 - Part1.PNG
Neither works. I have the following code:
%% 1. System Description
%
% <<Part1.PNG>>
%
and Im still getting:
[ERROR] FOUserAgent - Image not found. URI: file:///Part1.PNG. (See position -1:-1)
[ERROR] FOUserAgent - Image not found. URI: file:///Part1.PNG. (No context info available)

サインインしてコメントする。


Jason Yoon
Jason Yoon 2022 年 1 月 29 日
I had the same issue and the workaround I did was generate it as an html file, put the graphics into the html folder and used my browser to print to pdf. The format is a bit different, but it's still a pdf of the published document.

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2022 年 1 月 29 日
% Use a proper image read command:
image(imread('https://www.mathworks.com/help/examples/matlab/win64/ReadandDisplayImageExample_01.png'));
% Save your M-file, e.g.: PDF_publish.m
% Now you can recall it from the command window with:
>> publish('PDF_publish.m','pdf') % This creates a report in a PDF format called PDF_publish.pdf and saves in a folder in a current diectory of MATLAB

Ricardo
Ricardo 2024 年 6 月 8 日
Had the same problem. My error was that I had the .png file in the folder where my .m was, instead of in the folder where the .html was. When you press Publish, MATLAB generates a new folder inside the folder where your .m is, called html, that contains the generated .html. There's where you should put the image file.

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by