MATLAB: ()-indexing must appear last in an index expression

error

I get this error related to this line of code:
A(l,c)=A(l,c)+(b(l)(D(1,h))*b(c)(D(1,h)))
b is a vector that in each position has a function(like x^2), and D is a matrix whose all components are numbers. What i whant to do here is calculate the value of the functon b(l) on D(l,h)

Best Answer

MATLAB does not support arrays of function handles (some earlier versions did what version are you using?). Use a cell array containing the function handles then you should be able to use the line:
A(l,c)=A(l,c)+(b{l}(D(1,h))*b{c}(D(1,h)))
Note changing ( to { for accessing b.