Publish function code

조회 수: 30 (최근 30일)
Nuno
Nuno 2011년 3월 28일
While I'm publishing a M file, I also would like to publish some user defined functions. Can I have that done on the same output if the function is defined on another file?

채택된 답변

Andrew Newell
Andrew Newell 2011년 3월 28일
I haven't found an easy way to do this, and I hope someone else can improve on my answer. Here's my approach, which requires some familiarity with HTML. First, publish each function separately. You need to set evalCode to false, which you can do using the menu File -> Publish configuration for myfunction.m or these commands:
publishOptions.evalCode = false;
publish('myfunction.m',publishOptions)
Then you cut and paste the relevant HTML, which will be a block like this
<pre class="codeinput"> ... </pre>
into your main published file.
(Edited for clarity.)
  댓글 수: 1
Oleg Komarov
Oleg Komarov 2011년 3월 28일
Or if you don't care about formatting, then inside the file you're gonna publish use:
type('yourfilename')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Adding custom doc에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by