help-octave
[Top][All Lists]
Advanced

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

Re: Indexing functions?


From: Doug Stewart
Subject: Re: Indexing functions?
Date: Mon, 9 Oct 2017 08:26:06 -0400



On Mon, Oct 9, 2017 at 8:00 AM, Doug Stewart <address@hidden> wrote:


On Mon, Oct 9, 2017 at 7:26 AM, denizyazgac <address@hidden> wrote:
Hi;
I have a function  depends on X and Y. I know X, thats an array so my
function only depends on X
But I want to create an "array of functions" which behave like

f(1)= Y*1^2
f(2)=Y*2^2
f(3)=Y*3^2
.


-- 



clear


for index=1:10;
  f(index)={@(y) y*index.^2};
end

feval(f{3}, 1 )

feval(f{10}, 2)
DAS


reply via email to

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