For loop issue using fprintf to output contour3 levels to file.

1 view (last 30 days)
Attempting to separate the contour3 output to a file (test.txt) with rows of x,y,z coords to represent contour levels.
My current issue is that I can't see how to make the For loop move to the second level, it stops after outputting the 8 entries of vertices that are in Level A. To be clear, each level is at a particular z-value.
The link above is the help file for contour3 outputs, it's a bit specific. And those are the formatting rules I'm following.

Accepted Answer

Walter Roberson
Walter Roberson on 5 Oct 2020
I recommend that you use a utility routine from the File Exchange: https://www.mathworks.com/matlabcentral/fileexchange/38863-extract-contour-data-from-contour-matrix-c
  4 Comments
Adam Danz
Adam Danz on 6 Oct 2020
Edited: Adam Danz on 6 Oct 2020
I shared an alternative function on the file exchange that organizes the contour coordinates in a table. The Level column shows the contour level. Since there can be more than 1 contour line at the same level, the Group column is a grouping variable that identifies which contour line each coordinate belongs to.
contourTable =
n×4 table
Level Group X Y
________ _______ _______ _______
-5.8504 1 0.44266 -1.75
-5.8504 1 0.375 -1.8038
-5.8504 1 0.25 -1.8526
-5.8504 1 0.125 -1.8498
etc...

Sign in to comment.

More Answers (0)

Categories

Find more on Debugging and Analysis in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!