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



Cedric
Posts:
1
Registered:
2/11/14


Re: Looking for "publish" example for a function with input arguments.
Posted:
Feb 11, 2014 7:06 PM


"WASSIM " <mhiriwassim@gnet.tn> wrote in message <ksbi0p$ei4$1@newscl01ah.mathworks.com>... > "Steven_Lord" <slord@mathworks.com> wrote in message <kmteia$hr3$1@newscl01ah.mathworks.com>... > > > > > > "Matt Jecha" <jechamt+mathworks@gmail.com> wrote in message > > news:kmse26$jqv$1@newscl01ah.mathworks.com... > > > I have been searching for the same answer as to how to implement the > > > options structure or namevalue pairs in the publish() function. > > > when I use this structure to publish a function with input arguments > opts.codeToEvaluate=[ > 'plotData', char(10),... > 'plot_report(plotData)',char(10)]; > > I got the following error: > Error using evalin > Undefined function or variable 'plotData' > > I don't understand why I got this error as I define the variable just before calling the publish function. > > And when I try with this simple example it's working: > f.x =0:0.1:10; > f.y = 0:0.5:50; > function_options.codeToEvaluate=[ > 'f', char(10),... > 'test(f)',char(10)]; > publish('test',function_options); > > function test(f) > figure; > plot (f.x, f.y); > end > > is there any size limitation to pass the input arguments to the publish function??
Hi everyone, I am having the same kind of issue... Has this ever been resolved? Also, the link posted above is broken:(http://www.mathworks.com/support/solutions/en/data/197WVV6/?solution=197WVV6)
My code is the following: [...] for d = 1:sizeOfSomething functionOpts.codeToEvaluate=['fullFileList{d}', char(10),'my_func(fullFileList{d})']; functionOpts.evalCode = true; functionOpts.format = 'html'; functionOpts.outputDir = savingPath; publish('my_func',functionOpts); end [...]
Error using ==> evalin Undefined function or variable 'd'.
The error I am getting is that the "code to be evaluated" does not know 'd'. Then I tried replacing 'fullFileList{d}' by it's actual string but I get another error (Unexpected MATLAB Operator).
Does anybody knows what is wrong here? Also, what is the purpose of the "newline" in the middle (char(10))?
Thanks



