Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
Looking for "publish" example for a function with input arguments.
Replies:
7
Last Post:
Sep 16, 2014 2:11 PM




Re: Looking for "publish" example for a function with input arguments.
Posted:
May 14, 2013 12:20 AM


I have been searching for the same answer as to how to implement the options structure or namevalue pairs in the publish() function.
I found this solution from the 2008 MATLAB version: http://www.mathworks.com/support/solutions/en/data/197WVV6/?solution=197WVV6
Which cites a wrapper function with the following code: function mypublish(fun,funcall,inputs)
opts.codeToEvaluate=[ inputs, char(10),... funcall,char(10)];
publish(fun,opts)
web([pwd '\html\' fun '.html'])
used to publish the hypothetical function foo(): function foo(a) plot(a); end
For a school project, I am attempting to write an automated script which runs through a lowpass filter generation scheme in a fourlevel for loop iteration, changing one parameter through several values at each level. In the heart of this for loop, I would like to publish a function I have written that generates the filter and plots its impulse response as a separate file.
Jim Rockford <jim.rockford1@gmail.com> wrote in message <c52b56c9ec1f4476a9569af54a0c64e4@googlegroups.com>... > I can't seem to find a straightforward example on using the "publish" function when it's a function being published that takes input arguments. > > For example, I have the function z = myfunk(x,y) > > The simple publish command >> publish('myfunk','doc') > of course doesn't work > because the input arguments x and y aren't known. > > What is the syntax for specifying the input arguments x,y to publish this function? > > The documentation just says > "Additional code to evaluate during publishing, specified as the commaseparated pair consisting of 'codeToEvaluate' and the string with the corresponding code. Use this option to specify code that does not appear in the MATLAB file, for example to set the value of an input argument for a function being published." > > Sorry, but I find this too opaque absent a single clear example showing this syntax. > > Thanks for the help. > > JR



