I would like to close the open contours in the attached image. The contour lines just stop at both the top and bottom of the image. I am trying to find a non-image analysis solution, as this plot was created with the contour function using the following syntax:
[C, h] = contour(X, Y, Z, [level_1 level_2 level_3 level_4 level_5]);
I would like it to close with just a horizontal line connecting to the corresponding isoline/color at both the top and bottom. Either a programatic or brute force solution would be ok with me. I would like to have the connected contour plot available as a Contour matrix, which is what the contour function outputs (https://www.mathworks.com/help/matlab/ref/contour.html).