[Pkg-octave-devel] Bug#491878: Bug#491878: closed by Rafael Laboissiere <rafael at debian.org> (Bug#491878: fixed in octave-image 1.0.6-3)
Francesco Potorti`
Potorti at isti.cnr.it
Fri Jul 25 07:27:07 UTC 2008
>> In that function, "map" is the first argument of the function, an
>> unfortunate name choice. Even this is not a bug, I suggest you change
>> "map" to something else to avoid confusion.
>
>Why do you think it is unfortunate? The argument of rgbplot is a color map,
>so that "map" seems to be fully appropriate. Besides, there is no map()
>function in Octave, such that there is no danger of confusion. Or am I
>missing something?
Yes :) Currently, Octave has a map function:
octave> help map
-- Function File: RESULT = map ( fun_handle, varargin )
usage: result = map ( FUN_HANDLE, ARG1, ... )
map, like Lisp's ( & numerous other language's ) function for
iterating the result of a function applied to each of the data
structure's elements in turn. The results are stored in the
corresponding input's place. For now, just will work with cells and
matrices, but support for structs are intended for future versions.
Also, only "prefix" functions ( like "min(a,b,c,...)" ) are
supported. FUN_HANDLE can either be a function name string or a
function handle (recommended).
Example:
octave> A
A
{
[1,1] = 0.0096243
[2,1] = 0.82781
[1,2] = 0.052571
[2,2] = 0.84645
}
octave> B
B =
{
[1,1] = 0.75563
[2,1] = 0.84858
[1,2] = 0.16765
[2,2] = 0.85477
}
octave> map(@min,A,B)
ans =
{
[1,1] = 0.0096243
[2,1] = 0.82781
[1,2] = 0.052571
[2,2] = 0.84645
}
See also: reduce, match, apply .
octave>
More information about the Pkg-octave-devel
mailing list