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 件のコメント
Wthee
Wthee 2020 年 10 月 6 日
Thank you
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 Center および File ExchangeDebugging and Analysis についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by