Publish a Function which has Input Arguments

Hi Everyone, I am calling a function with three input arguments and I want to publish this function. The name of my function is myfunc(x,y,z). I know that my function can be published using the command publish('myfunc.m'), but i am unable to enter the input arguments using this publish command. I cannot declare these input arguments globally as it can cause other problems in my script. Can anybody please tell me how to publish a function which has input arguments ?
P.S. Note : I tried using save2pdf, export_fig, etc. to convert my figures to pdf format, but in vain as its illegal to use ghostscript in a professional environment without a commercial licence. Any kind of help would be much appreciated. Steve

 채택된 답변

Steven Lord
Steven Lord 2016년 4월 21일

1 개 추천

Take a look at the codeToEvaluate option for the publish function.

댓글 수: 1

Tennis John
Tennis John 2016년 4월 21일
I tried it , but no figure was displayed in the pdf file.

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

추가 답변 (1개)

Tennis John
Tennis John 2016년 4월 21일
편집: Walter Roberson 2016년 10월 9일

0 개 추천

Here is the code :
Publish_Trials(c)
a = 1 :10; b= 2:2:20;
a= a*c;
plot(a,b);
Then i used
options.codeToEvaluate = 'c=1;'; options.format = 'pdf'; publish('Publish_Trials.m',options);
But no figure was displayed in the pdf.

댓글 수: 2

You never called Publish_Trials. Try this code (I haven't tested it but it should work.)
options.codeToEvaluate = 'c = 1; Publish_Trials(c)';
options.format = 'pdf';
publish('Publish_Trials.m', options);
@Steven Lord Your solution worked!

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

카테고리

도움말 센터File Exchange에서 Historical Contests에 대해 자세히 알아보기

태그

질문:

2016년 4월 21일

댓글:

2021년 3월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by