Modifying contour levels from GUI

1 回表示 (過去 30 日間)
Tomy Duby
Tomy Duby 2016 年 11 月 2 日
回答済み: Kushagr Gupta 2016 年 11 月 9 日
How can I change contour levels from the contour plot GUI?

採用された回答

Kushagr Gupta
Kushagr Gupta 2016 年 11 月 9 日
There may not be a straightforward to do what is being asked for. But, while the contour plot is active, if the 'contour' command is executed with same arguments and an additional argument specifying the number of contour levels the same plot gets updated to reflect the specified number of contours.
The following code (taken from the documentation of ' contour ' command) illustrates this:
x = -2:0.2:2;
y = -2:0.2:3;
[X,Y] = meshgrid(x,y);
Z = X.*exp(-X.^2-Y.^2);
figure
contour(X,Y,Z)
Now if we try:
contour(X,Y,Z,8)
% Plot gets updated to show 8 contours
Using GUIDE or App Designer, one can have an interface in the GUI to change the number of levels and use the above mentioned command in the callback to do what is being asked for.
Hope this helps!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by