# Publishing with MATLAB

## Publishing with MATLAB


       
  
MATLAB includes an automatic report generator called publisher. The publisher publishes a script in several formats, including HTML, XML, MS Word and PowerPoint. The published file can contain the following:

1. Commentary on the code,
2. MATLAB code,
3. Results of the executed code, including the Command Window output and figures created by the code.

### The publish Function

The most basic syntax is publish('file','format') where the m-file is called and executed line by line then saved to a file in specified format. All published files are placed in the html directory although the published output might be a doc file.


### Publishing with Editor

The publisher is easily accessible from the Tool Strip:




### The Double Percentage %% Sign 

The scripts sometimes can be very long and their readability might be reduced. To improve the publishing result, sections are introduced by adding descriptive lines to the script preceded by %%. Consider the following example.


### Summary of Key Points

1. MATLAB can generate reports containing  commentary on the code, MATLAB code and the results of the executed code,
2. The publisher generates a script in several formats, including HTML, XML, MS Word and PowerPoint.
3. The Double Percentage %% can be used to creates hyper-linked sections.