octave-maintainers
[Top][All Lists]
Advanced

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

Re: colormap not returning value


From: Kai Habel
Subject: Re: colormap not returning value
Date: Tue, 06 Nov 2007 22:10:56 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20070801)

David Bateman schrieb:
> Daniel J Sebald wrote:
>   
>> Counter to colormap documentation, nothing is being returned when there
>> are no arguments, e.g., colormap()
>>
>> The attached patch might be more in line with documentation.
>>
>> Dan
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> --- /usr/local/src/octave-cvs/octave/scripts/image/colormap.m        
>> 2007-11-06 09:26:00.000000000 -0600
>> +++ colormap.m       2007-11-06 14:36:09.233214868 -0600
>> @@ -70,7 +70,7 @@
>>    endif
>>  
>>    ## Return current color map.
>> -  if (nargout > 0)
>> +  if (nargout >= 0)
>>      cmap = get (gcf (), "colormap");
>>    endif
>>  
>>     
>
> I believe this was deliberate as I don't think matlab returns the
> colormap without a return argument, though that should be checked.. In
> that case it is the doc string that should be changed instead.
>
> D.
>
>   

You are both right and wrong ;-)

If no input *and* no output argument is given, matlab returns the
current colormap.
If no output argument but an input argument is given, the colormap of
the current figure is changed but nothing returned.

See the attached patch.

Kai
--- colormap.m.orig     2007-11-06 22:04:06.000000000 +0100
+++ colormap.m  2007-11-06 22:06:10.000000000 +0100
@@ -70,7 +70,7 @@
   endif
 
   ## Return current color map.
-  if (nargout > 0)
+  if (nargout > 0 || (nargout == 0 && nargin == 0))
     cmap = get (gcf (), "colormap");
   endif
 

reply via email to

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