Will not publish to pdf

조회 수: 218 (최근 30일)
Kevin Castillo Balcaceres
Kevin Castillo Balcaceres 2021년 8월 29일
답변: Shanmukha Voggu 2021년 9월 1일
Error reported by XML parser: An invalid XML character (Unicode: 0x1a) was found in the element content of the document.
Error using publish
.m file must contain valid XML 1.0 Standard characters.
Error in mdbpublish (line 54)
outputPath = publish(file, options);
Error using open (line 52)
File or variable name must be a character vector or string scalar.
My file name does not have any spaces and neither do any of the names of the path. I am unsure what is causing this.

답변 (1개)

Shanmukha Voggu
Shanmukha Voggu 2021년 9월 1일
Hi Kevin,
It is likely there is a special character somewhere in your file. If you are able to run the file without any issues, it is likely somewhere in the comments.
Attached is an example of an M file with a special character in its comments.
If you cannot find a special character in your file, another thing to check would be any places where "char" is called on a number. The way "char" function works is to create unicode commands of the numbers, so this is an easy way to generate invalid XML characters. For example:
char(20)
ans = ''
For converting numbers to characters it is recommended to use "num2str" instead of "char":
num2str(20)
ans = '20'

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by