So, this is a somewhat strange "interpolation" (and extrapolation) problem. It requires certain assumptions to leap from your data to the result. Are you saying that your data are effectively the following?
And, are you saying that your data exist at x values of 1:10, because of the length of your original vector?
And, are you saying that you want to linearly extrapolate outside the range 4:7?
If all of that is true, then I guess this does what you want.
data = [0, 0, 0, 4, 0, 0, 7, 0, 0, 0];
yq = interp1(x,y,xq,'linear','extrap')
But this solution hinges on the fact that the element positions (1st element, 2nd element, and so on) are equivalent to the data values, which is really strange. So, I have my doubts that this will achieve what you want in your actual real-life problem.