Your curve is somewhat noisy. I might think to point out that my interparc tool from the file exchange can be made to give estimates of the derivatives of the curve at any point along the curve. So it would return two numbers at a point that are essentially dx/dt and dy/dt. The ratio is the slope of the tangent line at that point.
The above works even for non-functional closed curves as you have, since interparc works in a parametric form. It computes a simple cumulative linear chordal arclength along the curve, then uses spline models x(t), y(t).
The problem is, your data is somewhat noisy, based on the curve we are shown. So that tangent line would be pointing all over the place.
Anyway, if you were to use interparc in that way, then it would be just as simple to do the work yourself. You do not provide your data. But, suppose you have data that is in the form of two vectors x and y, sorted in order along such a path in the (x,y) plane?
t = cumsum([0;diff(x(:)).^2 + diff(y(:)).^2)]);
So, t is the cumulative piecewise linear distance between each point, one to the next along your curve.
splx = spline(t,x);
sply = spline(t,y);
Differentiate each spline, then evaluate the ratio of the derivatives at the original points. That is the slope of the tangent line, at that point. If you have the curve fitting toolbox, you can use fnder to differentiate the splines.
tanslope = ppval(fnder(sply),t)./ppval(fnder(splx),t);
If no curvefitting toolbox, the derivative function is trivial to generate for the pp form that spline returns.
Again, the issue is that you may wish to produce a smoother estimate of the tangent slope. If you provide your data, and you need such a smoothed tangent line, just attach the data to a .mat file as a comment.