在此 https:/www.mathworks.commatlabcentralanswers392471-hi-how-can-i-generate-a-pdf-file-in-matlab-with-information-from-code 他们使用下面的脚本来创建一个PDF文件
%%publish example
X = randn(1,100);
mean(x)
std(x)
hist(X)
他们是怎么做到的?我不知道如何在脚本中使用发布命令。
这不是用来生成PDF的代码,这是他们发布的示例代码。
他们使用MATLAB GUI的 "发布 "选项卡来发布该代码(将其输出为PDF)。
Publish
-> Publish
-> -> -> -> Edit Publishing Options
-> -> -> Output Format: PDF
要从脚本中发布,使用 publish
命令。
publish('myfile.m','pdf');
(help publish
更多)