How to avoid to plot the NAN value?

조회 수: 14 (최근 30일)
Tan Has
Tan Has 2012년 9월 17일
I am using following command
quiver(xarray(1:4:end),yarray(1:4:end),DV_XX(1:4:end),DV_YY(1:4:end),1, 'k','filled');
which is plotting the vector for every node. I want to plot for every alternate node that means it will plot 1st node then do not plot arrow for 2nd node the again plot the arrow for 3 rd node.
then rearranging the above code I manage to plot that.
THIS IS WORK FOR ME
XX_t = DV_XX(1:4:end);
XX_t(3:3:end) = NaN;
YY_t =DV_YY(1:4:end);
YY_t(2:3:end) = NaN;
quiver(xarray(1:4:end),yarray(1:4:end),XX_t,YY_t,1, 'k','filled');
BUT THE NAN VALUE IS PLOT AS A DOT IN THE FIGURE. I DON'T WANT TO SHOW THAT. HOW CAN I DO THAT???

채택된 답변

José-Luis
José-Luis 2012년 9월 17일
편집: José-Luis 2012년 9월 17일
Assuming all dimensions match:
XX_t = DV_XX(1:4:end);
XX_t(3:3:end) = NaN;
YY_t =DV_YY(1:4:end);
YY_t(2:3:end) = NaN;
Then:
tempX = xarray(1:4:end);
tempY = yarray(1:4:end);
idx = ~isnan(XX_T) & ~isnan(YY_t);
quiver(tempX(idx),tempY(idx),XX_t(idx),YY_t(idx),'k','filled');

추가 답변 (1개)

Lorenzo
Lorenzo 2012년 9월 17일
If you plot:
quiver(x,y,Dx,Dy);
you will see a arrow from the position (x,y) to the position (x+Dx,y+Dy)
If yout plot:
quiver(x,y,NaN,NaN);
you will see a dot in the position (x,y)
If you plot:
quiver(NaN,NaN,NaN,NaN);
you won't see anything
Set the positions to NaN

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by