octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shouldn't mesh treat NaN and NA in the same way?


From: John W. Eaton
Subject: shouldn't mesh treat NaN and NA in the same way?
Date: Wed, 2 May 2007 12:15:20 -0400

On  2-May-2007, Evan wrote:

| In octave 2.9.10, mesh treat NaN and NA differently.
| 
| octave:1> z1=[NaN, 2, 3; 4, 5, 6; 7, 8, 9]
| z1 =
| 
|    NaN     2     3
|      4     5     6
|      7     8     9
| 
| octave:2> z2=[NA, 2, 3; 4, 5, 6; 7, 8, 9]
| z2 =
| 
|     NA     2     3
|      4     5     6
|      7     8     9
| 
| octave:3> mesh(z1)
| octave:4> mesh(z2)
| octave:5> Notice: No surface grid anything could be hidden behind

I checked in the following change.

Thanks,

jwe

scripts/ChangeLog:

2007-05-02  John W. Eaton  <address@hidden>

        * plot/__go_draw_axes__.m: Convert NA to NaN before writing.


Index: scripts/plot/__go_draw_axes__.m
===================================================================
RCS file: /cvs/octave/scripts/plot/__go_draw_axes__.m,v
retrieving revision 1.17
diff -u -u -r1.17 __go_draw_axes__.m
--- scripts/plot/__go_draw_axes__.m     25 Apr 2007 17:26:49 -0000      1.17
+++ scripts/plot/__go_draw_axes__.m     2 May 2007 16:14:29 -0000
@@ -889,6 +889,13 @@
 
   ## FIXME -- this may need to be converted to C++ for speed.
 
+  ## Convert NA elements to normal NaN values because fprintf writes
+  ## "NA" and that confuses gnuplot.
+  idx = find (isna (data));
+  if (any (idx))
+    data(idx) = NaN;
+  endif
+
   if (nd == 2)
     nan_elts = find (sum (isnan (data)));
     fmt = strcat (repmat ("%g ", 1, rows (data)), "\n");

reply via email to

[Prev in Thread] Current Thread [Next in Thread]