Say I have a vector like [10,3,4], is there a way to get, for instance, the second element directly? Something like:
[10,3,4](2)
Also, if I have a cell of anonymous functions,such as:
funcs = {@(s) s^2 , @(s) s+5},
is there a way to access them in a way like:
funcs{2}(s)
(Edit: funcs{2}(s) works. It turns out the error I got was because of something else!) What I want to do is to save the gradient of a function in a cell like $gradr$ and then be able to get its dot product with another vector. Something lik:
dot([gradr{1}(s),gradr{2}(s)],n)
I cannot assign each component a different name since I'll be using the numbering later.
Thank you in advance.
Edit: the answer to the first part of my question can be found here.