Get contour matrix without plotting?

I have a big gridded dataset Z and I want to create a contour matrix C from it. I need contours at many levels, -100:2:100. I can do this:
C = contour(Z,100:2:100);
Unfortunately, computation time is slow, it takes several minutes because my Z is large and I am trying to get a lot of countour lines out of it. How can I speed this up? I was hoping I could get C without plotting, but I don't know how to do that. I tried turning the figure visibility off but that had only a quarter of a second improvement out of several minutes computation time.
Ideas?

1 件のコメント

Chad Greene
Chad Greene 2013 年 9 月 20 日
Any tips for speeding up the acquisition of C?

サインインしてコメントする。

 採用された回答

Moritz
Moritz 2013 年 9 月 20 日

4 投票

Have you tried contourc instead of contour ? It gives you the contour lines without any plots.
[cline]=contour(Z,[1 1]); gives you one contour line at level 1 Of course you can do many levels.
With one level: cline(1,2:end) contains your x values cline(1,1) contains the level cline(2,1) contains the numer of data poinst cline(2,2:end) contains your corresponding y values
with multiple values it just adds the new level at the end of the array, you can find it by the entry of it´s level

2 件のコメント

Chad Greene
Chad Greene 2013 年 9 月 20 日
This is exactly what I was seeking. Thank you so much!
Chad Greene
Chad Greene 2014 年 5 月 22 日
I have uploaded the solution to FEX:

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeContour Plots についてさらに検索

タグ

質問済み:

2013 年 9 月 13 日

コメント済み:

2014 年 5 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by