フィルターのクリア

Fill polygon with NaN data

2 ビュー (過去 30 日間)
Pengfei
Pengfei 2012 年 11 月 3 日
Hi, I have data matrix with NaN, and I want to fill the polygon colored. It seemed Matlab cannot close the polygon automatically, thus wouldn't color it.
X_data =
[13.3596 16.1477
13.3596 16.1477
21.1457 17.0037
21.1457 20.0392
13.3596 21.5270
13.3596 21.5270
13.3596 20.0392
NaN 17.0037
NaN 16.1477
NaN 16.1477
NaN 16.1477]
Y_data =
[ 0 0
1.8725 1.8725
16.9650 4.9160
16.9650 13.2470
1.8725 16.9662
0 16.9662
0 13.2470
NaN 4.9160
NaN 1.8725
NaN 0
NaN 0]
Z_data =
[ -0.8831 -1.0298
-0.8831 -1.0298
-0.1197 -0.9071
-0.3400 -0.3906
-1.6715 -0.1558
-1.6715 -0.3172
-0.8831 -0.6376
NaN -1.3943
NaN -1.7909
NaN -1.7909
NaN -1.0298];
The figure I want should have two surfaces, defined by each column from the data. The presence of NaN make matlab only draws the outline for the surface; the second surface is ok. I used:
fill3(X_data,Y_data,Z_data,'r')
Any suggestions? Thank you!
  3 件のコメント
Gang-Gyoo
Gang-Gyoo 2012 年 11 月 4 日
How about using these codes
fill3(X_data(1:7,1),Y_data(1:7,1),Z_data(1:7,1),'r')
hold on
fill3(X_data(:,2),Y_data(:,2),Z_data(:,2),'r')
hold off
grid on
Pengfei
Pengfei 2012 年 11 月 6 日
Hi, Thanks! That actually helps. I didn't realize the small trick!

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation of 2-D Selections in 3-D Grids についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by