From: Tomer A. <ta...@lb...> - 2003-11-23 08:23:26
|
Introducing 'map': ## usage: [ result ] = map ( FUN_STR, 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 "postfix" functions ( like "min(a,b,c,..)" ) are ## supported. ## ## 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 ## } Uploaded to Octave-Forge: octave-forge/main/miscellaneous --- Cheers, ~Tomer |