|
"Dave Brackett" <davebrackett@hotmail.com> wrote in message <h1666i$8n9$1@fred.mathworks.com>...
> Up until recently I have been using str2func for specifying some options for an optimisation run. With r2009a this is no longer allowed and I get the error message: "??? Undefined function or method 'str2func' for input arguments of type 'cell'."
>
> This worked fine in 2008a and I read from Loren's blog that there have been some changes to str2func in the latest release (Starting in Release 2009a, str2func lets you create a handle to anonymous function. Before that, you need to construct an anonymous function from literal strings, or using some ugly code involving eval.).
>
> I cannot work out what I need to change to get it to work in my case. Can anyone shed some light on what I'm missing please? Thanks. A snippet of the code is below:
>
> options=saoptimset('AnnealingFcn',str2func(current_options.annealing_function),...
> 'TemperatureFcn',str2func(current_options.temperature_function),...
> 'AcceptanceFcn',str2func(current_options.acceptance_function));
ah isn't it always the way that as soon as you post the question, you work out the answer! Simply just needs to use char() to convert from cell. Funny I didn't think of that earlier!
|