I have plotted contour lines on a surface.

I can see smooth lines on paraview but once I export it to file,

all the contour lines are not sequential (independent points).

How can I export as closed lines in a sequence.

Which format do you export to ?

Any ASCII format is ok with me.

I will import the file into Matlab.

Afaik matlab does not support 3D format with topology,

Whatever the format is, if the file is written in ASCII, I can import into Matlab.

The problem is that all the points are not in the sequence and do not construct a loop as the Paraview contour plots.

Matlab is only drawing lines between points in sequence, no idea if you can draw actual line in matlab.

Matlab is not important. I am just drawing between two points.

Any other plot tools is OK. The problem is the sequence of the points of the contour lines that Paraview extracts.

What is your ParaView question here ?

I have plotted contour lines with Paraview.

Contour lines seem to be ok. but once I saved the lines with CSV file,

all the points in the CSV files are not in the sequence. They do not make a closed loop.

My question is how do I make them as the order that makes a closed loop?

You need to reorganize your points, maybe doable with a prog filter, but that seems unpractical.

Try using the `Plot On Sorted Lines`

filter on the contour lines.

Thank you. Using the Plot On Sorted Lines worked except for the connection between islands of the contours, I could import to Matlab and obtained the plot attached.

How could I identify each points belonging to different islands?

You can use the `Connectivity`

filter to identify each island. A new field named `RegionId`

will be added that gives a unique number for each island.

You can then use `Threshold`

to extract one island at a time and write out a separate csv file. Or, you can use this field in Matlab to remove lines from one island to the next. Draw lines if the `RegionId`

is the same. Don’t draw a line between consecutive points with different `RegionId`

values.