am currently writing a octave (octave2.9) code and I would like to use the arrayfun
and cellfun function to apply a function depending on several input on
each elements of an array or on each elements of a cell.
I read the Workmath help pages afor cellfun and arrayfun. They say : "The first input argument
a function handle to a function that takes one input argument and returns
a scalar value". Does that mean that the function fun has to take only ONE input argument and return a scalar ?
If I have a function t=f(a,b,c) and that I ant to aplly it on
several arrays A,B and C (A representing the variable a, B
representing the variable b, C epresenting the variable c), and get the
result in an array T ? is it possible ? ... Well, I tried it but it
seems that it doesn't work ...but I don't know if it's a problem of
syntax or not...
(here is a simple exemple I've tested
"simple is a function saved in the simple.m file"
ans = 7
error: `y' undefined near line 2 column 7
error: evaluating binary operator `+' near line 2, column 6
error: evaluating assignment _expression_ near line 2, column 2
error: called from `simple' in file `/home/gervais/2007/Noise/interface/simple.m'
error: called from `arrayfun' in file `/usr/share/octave/2.9.6/m/miscellaneous/arrayfun.m'
error: evaluating assignment _expression_ near line 3, column 2
If I use a function depending only of one variable, it works ....
well, I don't kown what's wrong....
Have you any idea ?