I'm trying to speed up a function Foo that calls 'integral' thousands of time. The profile viewer reveals that more than half of integral's time is spent in calls to the sub-function integralParseArgs. At a guess from that latter function's name, this time is wasted in my case, because my Foo always calls 'integral' with exactly the same arguments.
I looked at the code for the 'integral' function, and after a little argument checking it just does this:
opstruct = integralParseArgs(varargin{:});Q = integralCalc(fun,a,b,opstruct);
Great, I thought, I can just make one opstruct and then call integralCalc repeatedly. Unfortunately, I don't seem to be able to call either integralParseArgs or integralCalc:
Undefined function or variable 'integralParseArgs'. Undefined function or variable 'integralCalc'.
So, I'm looking for any suggestions about how to speed up integral when calling it repeatedly with only 'a' and 'b' changing.
Thanks for your thoughts.
PS: Both of the following commands produce output just fine, and I'm wondering why the functions are known to 'type' but can't be called.
type integralParseArgstype integralCalc
Best Answer