MATLAB: Trimming the first and last elements of a vector

vector

let's say that i have a vector of yhat =506×1 and i have an h = 3 value
how do I remove the first 3 elements and the last 3 elements of yhat so that it will be a 500×1 vector.
I currently wrote, yhat(h+1:end-h); but it gives me 6 zeros for the last results, and that is not what i want.
How do i fix this? I just want a new vector of yhat where it is 500×1 because I removed the first 3 and last 3 elements based on the size of h. thank you!
Thank you verym uch

Best Answer

Reassign in place...
yhat=yhat(h+1:end-h);