How can I publish to HTML without the MATLAB code being automatically inserted as comments into the generated HTML file in MATLAB 7.6 (R2008a) ?

10 views (last 30 days)
The 'showCode' property of the PUBLISH function is set to 'false' while the page source of HTML file shows the commented MATLAB code. I would like to know what to do if commented code is to be hidden.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 22 Jan 2010
Navigate to the folllowing folder :
$MATLABROOT\toolbox\matlab\codetools\private
where $MATLABROOT is the root MATLAB directory which can be found by typing
matlabroot
at the MATLAB Command Prompt.
Copy the 'mxdom2simplehtml.xsl' file from this directory and paste it to the location where the code to be published is present. Rename the xsl file as 'noCode.xsl' and remove or comment the following from the file:
##### SOURCE BEGIN #####
<xsl:value-of select="$xcomment"/>
##### SOURCE END #####
Use the following in your code:
options.stylesheet = 'noCode.xsl';
options.showCode = false;
Following is an illustrative example:
options.format = 'html';
options.evalCode = true;
options.stylesheet = 'noCode.xsl';
options.showCode = false;
options.codeToEvaluate = filename; % filename is the name of the file which is to be published
publish(filename,options);

More Answers (0)

Products


Release

R2008a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!