using publish with a function rather than script

조회 수: 2 (최근 30일)
siluu
siluu 2015년 9월 25일
편집: Joseph Cheng 2015년 9월 26일
I want to know if I can use matlab's publish functionality to generate a pdf report via a function call. So basically I have a function f , which does plotting and has latex code and I want to do something like
publish(f(a,b),'output.pdf')
Can matlab's publish function do that ?

답변 (1개)

Joseph Cheng
Joseph Cheng 2015년 9월 25일
yes it can. follow my example:
so i started a function called plotme()
function plotme(A,B)
figure,plot(A,B)
then to publish this function i need to set the options
options = struct('format','pdf','codeToEvaluate','plotme(1:10,1:10)')
and then i can go
publish('plotme.m',options)
Now you can set the destination etc read more here but i couldn't figure out how specify a name.
  댓글 수: 1
Joseph Cheng
Joseph Cheng 2015년 9월 26일
편집: Joseph Cheng 2015년 9월 26일
forgot to mention if you're not trying to do automatically when you run a script or other function. the publish gui/app is much easier to work with.
AND the options strings are case sensitive (at least when i tried) codetoevaluate was different than codeToEvaluate.

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

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by