Fill polygon with NaN data

1 visualización (últimos 30 días)
Pengfei
Pengfei el 3 de Nov. de 2012
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 comentarios
Gang-Gyoo
Gang-Gyoo el 4 de Nov. de 2012
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 el 6 de Nov. de 2012
Hi, Thanks! That actually helps. I didn't realize the small trick!

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Interpolation of 2-D Selections in 3-D Grids en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by