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

조회 수: 1 (최근 30일)
Wthee
Wthee 2020년 10월 5일
편집: Adam Danz 2020년 10월 6일
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.

채택된 답변

Walter Roberson
Walter Roberson 2020년 10월 5일
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
Adam Danz
Adam Danz 2020년 10월 6일
편집: Adam Danz 2020년 10월 6일
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...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by