make contourf work (again)

Kai Habel kai.habel at gmx.de
Sat Sep 6 09:13:12 CDT 2008


John W. Eaton schrieb:
> On  6-Sep-2008, Kai Habel wrote:
>
> | Hello,
> | 
> | with very recent checkout I see:
> | 
> | octave:1> contourf(peaks)
> | warning: meaning may have changed due to change in precedence for && and 
> | || operators
> | error: patch: X and Y must be of same size
> | error: called from:
> | error:   /home/kai/hg-octave/octave/scripts/plot/contourf.m at line 234, 
> | column 5
> | error:   /home/kai/hg-octave/octave/scripts/plot/contourf.m at line 67, 
> | column 32
> | octave:1>
> | 
> | I had to apply the attached fix
> | 
> | Kai
> | # HG changeset patch
> | # User kai at LxLap.site
> | # Date 1220704799 -7200
> | # Node ID e6892ff5a9cf40285ed007e4d4cb6b2e4115fab9
> | # Parent  46aa040553254660894f13bf131688ca8d384527
> | Make contourf work for equal-size matrices (again).
> | 
> | diff -r 46aa04055325 -r e6892ff5a9cf scripts/ChangeLog
> | --- a/scripts/ChangeLog	Wed Sep 03 11:40:55 2008 -0400
> | +++ b/scripts/ChangeLog	Sat Sep 06 14:39:59 2008 +0200
> | @@ -1,3 +1,8 @@
> | +2008-03-14  Kai Habel  <kai.habel at gmx.de>
> | +
> | +        * plot/contourf.m: Fix case for equal-sized matrices
> | +        of X and Y.
> | +
> |  2008-09-02  David Bateman  <dbateman at free.fr>
> |  
> |  	* plot/__add_datasource__.m: Fix indexing of varargin.
> | diff -r 46aa04055325 -r e6892ff5a9cf scripts/plot/contourf.m
> | --- a/scripts/plot/contourf.m	Wed Sep 03 11:40:55 2008 -0400
> | +++ b/scripts/plot/contourf.m	Sat Sep 06 14:39:59 2008 +0200
> | @@ -227,7 +227,7 @@
> |      arg(1:4) = [];
> |    endif
> |  
> | -  if (!isvector (X) || !isvector (Y) && any (size (X) != size (Y)))
> | +  if ((!isvector (X) || !isvector (Y)) && !size_equal(X,Y))
> |      error ("patch: X and Y must be of same size")
> |    endif
>
> So many nots!  Maybe it would be clearer to write
>
>   if (! ((isvector (X) && isvector (Y)) || size_equal (X, Y)))
>
> ?
>
> jwe
>   

O.k, bit I think both expression are not that easy to read. You
can use the attached changeset instead.

Kai


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch
Url: https://www-old.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080906/cf91ccd1/attachment.ksh 


More information about the Octave-maintainers mailing list