Q:

R1 to R1 MATLAB function using values from vector

I have some efficiency problems in my code that I could solve easily saving the values of an R->R function in a table/vector, and using the vector to give the results instead of computing the function expression every time. 
Is there an easy way to do it or I have to implement it for example using "find"?

A:

I think interp1 would do what you want, using the 'nearest' interpolation flag - check the documentation

