MATLAB Answers

0

Printing live script without code part

Asked by alpedhuez on 8 Jul 2018
Latest activity Commented on by Daniel Holstein on 25 Sep 2019
Is it possible to print a live script file without code so that readers can get output and graphics (but not code)?

  0 Comments

Sign in to comment.

Tags

Products

2 Answers

Answer by Yash Trivedi on 9 Jul 2018

Hi,
The ' publish ' method allows the user to generate a view of the MATLAB file in a specified format. You could publish a file in the HTML or PDF format and then print the published file. The method allows the user to specify a 'showCode' option which is set to true by default but can be set to false. If set to false, it won't include the code in the published file.
Refer to the following documentation for the proper syntax - https://www.mathworks.com/help/matlab/ref/publish.html#btbskip-options

  0 Comments

Sign in to comment.


Answer by Kevin Chng on 27 Mar 2019

Untitled.png
In 2019a, it allows you to hide the code before exporting.

  1 Comment

Is there a way to show some code sections, but not others? I am a professor, and sometimes I want to give a code snippet as an example, and then show (for example) a plot I want students to replicate, but I don't want to give them the answer... Thanks!

Sign in to comment.