Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Publish: make comments appear in published document

Asked by Christoph on 26 Apr 2013

I am using the publish function to create a documentation for my program. I am using code cells (lines starting with %%) to create sections in the published report. I know that the lines of comments following immediately after a %%-line will be regarded as descriptive text and appear as normal text in the published html-document (rather than as green comments as part of the code). Now I would like to find a way to mark comments that come further down in the cell to appear the same way in the published document (this is important, because I am not showing the code for all functions, and the comments that are part of the code will not appear then).

Here’s an example to illustrate what I mean:

%% Title1
% some comments
a = rand(5);
%%%
% some more comments
b = a.^2;
%%%
% even more comments
c = a+b;

This will publish to:

Title1

some comments

a = rand(5);

some more comments

b = a.^2;
%%%
% even more comments
c = a+b;

This is somewhat unexpected behaviour, as I would expect (and want) it to publish to:

Title1

some comments

a = rand(5);

some more comments

b = a.^2;

even more comments

c = a+b;

Is there any way to achieve this? I know that using %% instead of %%% will make it publish this way, but that will split the code cell in the editor which I would like to avoid.

0 Comments

Christoph

Products

No products are associated with this question.

1 Answer

Answer by per isakson on 26 Apr 2013
Accepted answer

Here R2012a,64bit,Windows7 produces the html-result, which you expect.

The on-line help says:

    Section title without cell break
    %%% SECTION TITLE
    % DESCRIPTIVE TEXT

I don't think the documentation has anything to say on the case that SECTION TITLE is empty.

1 Comment

Christoph on 26 Apr 2013

Interesting, thanks! I am using 2011b (64bit, Windows7), so maybe that's what's causing the difference. Good to know if it works that way in the later version (so all I need to do is finally run the update :)).

per isakson

Contact us