I suggest something like this:
function b=g(x)
b= 1/x
k= find( x1)
b( k)= x( k) + 1
endfunction
Fred
Le 19/04/2015 17:57, fujimoto2005 a écrit :
function b=g(x)if x1 then
b=x+1
else
b=1/x
end
___
users
Le 20/04/2015 12:09, Frederic Jourdin a écrit :
I suggest something like this:
function b=g(x)
b= 1/x
Almost. Just 2 chars missing. Let's fujimoto2005 find() which ones ;)
___
users mailing list
users@lists.scilab.org
I define a function with a scalar argument and use it with a matrix argument.
I want to get the matrix whose entry is the functional value for each entry
of a matrix argument.
When the function contains no if then close, I get the desired result as
the following function f.
However when the
You don't need find().
k = x1;
Stefan
On 2015-04-20 12:09, Frederic Jourdin wrote:
I suggest something like this:
function b=g(x)
b= 1/x
k= find( x1)
b( k)= x( k) + 1
endfunction
Fred
Le 19/04/2015 17:57, fujimoto2005 a écrit :
function b=g(x)if x1 then
b=x+1
Hello fugimoto2005,
You may use find():
b = x
k = find(x1)
b(k) = x(k)+1
Just do the same to process the second case.
Regards
samuelgougeon2015
Le 19/04/2015 17:57, fujimoto2005 a écrit :
I define a function with a scalar argument and use it with a matrix argument.
I want to get the matrix