Q:

Using arrays in function handler parametr

I have a problem with finding solution to my problem.
Is it possible to use arrays as argument in str2func?
Example:
A='@(X)10+(X(1)-2)^2+(X(2)+5)^2';
y=str2func(A);
y(someArray);

where X-array 1x2;

A:

sure:
A='@(X) 10+(X(1)-2)^2+(X(2)+5)^2';
y=str2func(A);
y([1 2])

just had to use the variable A instead of test in line 2. BTW, why are you using str2func? This is more straightforward:
y=@(X) 10+(X(1)-2)^2+(X(2)+5)^2;
y([1 2])

