Introduction to Matlab Publish

The publish command in Matlab allows us to use script files to create html documents, or other formats, which can include bodies of text to describe what is going on, with the actual commands to make it happen embedded in the document. The text mode makes use of the comment character - the percent sign. Two adjacent percent signs starting a line indicate the start of a body of text. Text on the line with the two percent signs is interpreted as a header.

Here is an example of how we might use Matlab as a simple calculator.

(3+4^2)/2.5
ans =

    7.6000