suppress command line outputs when publishing to html

3 ビュー (過去 30 日間)
Chad Greene
Chad Greene 2014 年 7 月 29 日
回答済み: Emil Andreasen Klahn 2023 年 5 月 3 日
I'm publishing an example file and one section looks like this
%%An example of a pcolor image
h = pcolor(x,y,z);
set(h,'facealpha',.3)
That pcolor figure sure looks nice.
This syntax should create html that looks something like this
An example of a pcolor image
h = pcolor(x,y,z);
set(h,'facealpha',.3)
[THE FIGURE GETS PRINTED HERE]
That pcolor figure sure looks nice.
However, the set command is throwing an error. The figure still gets created properly, but my html looks like this:
An example of a pcolor image
h = pcolor(x,y,z);
set(h,'facealpha',.3)
Error using set
Attempt to write a locked object.
Error in legendcolorbarlayout>validateTextObjects (line 1117)
set(get(ax,'Parent'),'Children',children);
Error in legendcolorbarlayout>doLayout (line 405)
if validateTextObjects(textObjects,ax)
Error in legendcolorbarlayout>doPixelBoundsCB (line 362)
doLayout(get(obj,'Parent'));
Error using set
Attempt to write a locked object.
Error in legendcolorbarlayout>validateTextObjects (line 1117)
set(get(ax,'Parent'),'Children',children);
Error in legendcolorbarlayout>doLayout (line 405)
if validateTextObjects(textObjects,ax)
Error in legendcolorbarlayout>doPixelBoundsCB (line 362)
doLayout(get(obj,'Parent'));
[THE FIGURE GETS PRINTED HERE]
That pcolor figure sure looks nice.
How can I suppress the error messages when publishing?

採用された回答

Chad Greene
Chad Greene 2014 年 7 月 29 日
I figured out a solution,
publish('myfile.m','maxOutputLines',0)
However, this suppresses all output for the whole file. Any way to suppress output for just a block?

その他の回答 (1 件)

Emil Andreasen Klahn
Emil Andreasen Klahn 2023 年 5 月 3 日
For other people that come here later: the publish-function has a keyword called 'evalCode', which can be set to logical 'false', and then the code won't be run when you publish html

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by