<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237267</link>
    <title>MATLAB Central Newsreader - How to hide _some_ commands in published m-files?</title>
    <description>Feed for thread: How to hide _some_ commands in published m-files?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 09 Oct 2008 14:22:01 -0400</pubDate>
      <title>How to hide _some_ commands in published m-files?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237267#604437</link>
      <author>Andres </author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
is there any kind of switch to hide a specific command in a published m-file? E.g. with a source file like this...&lt;br&gt;
&lt;br&gt;
?&lt;br&gt;
%% Demo file&lt;br&gt;
&lt;br&gt;
% assign constants&lt;br&gt;
a = 3;&lt;br&gt;
b = 5;&lt;br&gt;
&lt;br&gt;
% algorithm&lt;br&gt;
c = a./b;&lt;br&gt;
&lt;br&gt;
disp(['Result for c: ' num2str(100*c) '%']) % hide this&lt;br&gt;
?&lt;br&gt;
&lt;br&gt;
I want all commands to show up in the published file except for the disp(... command, but I want its output&lt;br&gt;
?&lt;br&gt;
Result for c: 60%&lt;br&gt;
?&lt;br&gt;
to appear.&lt;br&gt;
Thanks for your thoughts,&lt;br&gt;
Andres</description>
    </item>
    <item>
      <pubDate>Thu, 09 Oct 2008 15:49:01 -0400</pubDate>
      <title>Re: How to hide _some_ commands in published m-files?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237267#604449</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;Andres &quot; &amp;lt;rantore@werb.deNoRs&amp;gt; wrote in message &lt;br&gt;
news:gcl429$pco$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; is there any kind of switch to hide a specific command in a published &lt;br&gt;
&amp;gt; m-file? E.g. with a source file like this...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ?&lt;br&gt;
&amp;gt; %% Demo file&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; % assign constants&lt;br&gt;
&amp;gt; a = 3;&lt;br&gt;
&amp;gt; b = 5;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; % algorithm&lt;br&gt;
&amp;gt; c = a./b;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; disp(['Result for c: ' num2str(100*c) '%']) % hide this&lt;br&gt;
&amp;gt; ?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I want all commands to show up in the published file except for the &lt;br&gt;
&amp;gt; disp(... command, but I want its output&lt;br&gt;
&amp;gt; ?&lt;br&gt;
&amp;gt; Result for c: 60%&lt;br&gt;
&amp;gt; ?&lt;br&gt;
&amp;gt; to appear.&lt;br&gt;
&lt;br&gt;
There may be a more sophisticated way to do this, but one easy way is to &lt;br&gt;
write a short script file and call that script file instead of DISP:&lt;br&gt;
&lt;br&gt;
displayResult;&lt;br&gt;
&lt;br&gt;
where displayResult.m is:&lt;br&gt;
&lt;br&gt;
% begin displayResult.m&lt;br&gt;
disp(['Result for c: ' num2str(100*c) '%'])&lt;br&gt;
% end displayResult.m&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com </description>
    </item>
    <item>
      <pubDate>Fri, 10 Oct 2008 08:49:17 -0400</pubDate>
      <title>Re: How to hide _some_ commands in published m-files?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237267#604607</link>
      <author>Andres </author>
      <description>&quot;Steven Lord&quot; &amp;lt;slord@mathworks.com&amp;gt; wrote in message &amp;lt;gcl95d$1bd$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;Andres &quot; &amp;lt;rantore@werb.deNoRs&amp;gt; wrote in message &lt;br&gt;
&amp;gt; news:gcl429$pco$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; is there any kind of switch to hide a specific command in a published &lt;br&gt;
&amp;gt; &amp;gt; m-file? [..] &lt;br&gt;
&amp;gt; There may be a more sophisticated way to do this, but one easy way is to &lt;br&gt;
&amp;gt; write a short script file and call that script file instead of DISP:&lt;br&gt;
&amp;gt; [..]&lt;br&gt;
&lt;br&gt;
Thanks for your idea, Steve. I'd then have to write a script or function for any kind of code I want to hide, but it would definitely make the published file look a bit better. &lt;br&gt;
&lt;br&gt;
Maybe the only 'more sophisticated' method would be to post-process the html-file, i.e.&lt;br&gt;
&lt;br&gt;
- add a keyword comment to each line of code to hide, like '% *hide*'&lt;br&gt;
- write a function publishAndHide.m that publishes the m-file, looks for the keyword in the source part of the published file (after '##### SOURCE BEGIN #####'), and finally removes the corresponding lines in the html-part ...&lt;br&gt;
&lt;br&gt;
Humph, i'll think about if it's worth the effort. &lt;br&gt;
Does anybody know if the part of html-code containing one line of matlab-code could possibly span over more than a single line (wrapping,...?)? If not, finding the html-code to delete should be quite easy by directly searching the html lines (but there might be other pitfalls).&lt;br&gt;
Any further thoughts about this are appreciated.&lt;br&gt;
&lt;br&gt;
(Btw, just now I found a similar thread&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/174366#449320&quot;&gt;http://www.mathworks.com/matlabcentral/newsreader/view_thread/174366#449320&lt;/a&gt; )&lt;br&gt;
&lt;br&gt;
Regards&lt;br&gt;
Andres</description>
    </item>
  </channel>
</rss>

