Stuart McGarrity,Mathworks
该演示向您展示了如何将MATLAB代码从编辑器发布到HTML和其他格式,如果我们需要与他人共享或描述您的工作,则很有用。让我们首先打开一个示例脚本,以创建和过滤一些信号。要发布MATLAB代码,您必须首先将其分为部分,通过插入截面的打破百分比为单位。您还可以按工具条按钮添加部分。
如果您的代码分为几个部分,则可以一次在一个部分上迭代。您也可以执行一个部分并前进到下一个部分。要使用默认选项发布您的MATLAB代码,请在此处按下发布按钮。然后您的代码执行。并且为每个单元格生成的图形或文本结果将被捕获并发布给HTML,这是默认文档类型。
You can add more descriptive text and formatting to the output document. We will look at another version of this MATLAB file which has been added. You add a title by including a cell at the top without any code. You can add a description here or in any section. And the comments will be turned into body text in the output document.
You can give that cell names, which will be turned into section headings. You can format your document text by inserting special markup text. For example, you can write an equation using standard LaTeX markup.
您可以指定子弹。请注意,您可以在没有标头的单元中添加注释,以获取其他字体文本。您可以指定基本字体格式,例如单间隔或粗体。
还将捕获何时输出的命令,例如显示此变量B时。所有标记都可以通过上下文菜单或工具分按钮插入,例如,我们将插入超文本链接。
我们将再次发布。在这里,您可以看到文档标题和已变成身体文本的评论。这是方程。
Cell names have been turned into section headings, and a table of contents, created. There is the ability list, the mono-spaced text, and the bold text, and the command window output. You can specify different publishing settings for different files and also publish MATLAB code that is contained in a function file requiring input arguments by using published configurations.
这里有一些代码在MATLAB函数reads some data from a file that varies as a function of time and puts the information for one particular date that you specify as an input argument, such as-- you make a customized published configuration associated just with this file by clicking here. You can specify some code to run, particularly useful when calling a function with input arguments. You can specify different output formats, such as LaTeX, Word, PowerPoint. Here we will choose Word.
您可以指定是否包括代码或评估代码。您可以保存这些设置并将其重用以进行其他配置。然后,我们将关闭此内容,并使用新设置再次发布。
在这里,我们看到该文档以我们指定的格式生成。就像脚本一样,发布功能时,您可以通过在顶部插入附加单元格来包含标题。在这里,我们看到标题。您可以通过单击此处并指定其他选项或代码来为同一文件创建多个配置。那,我们从这里访问。
最后,您还可以使用发布功能从命令行创建文档。这是演示的结论。您现在可以在MATLAB中尝试这些示例,也可以观看其他视频之一。
您还可以从以下列表中选择一个网站:
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。