Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Function handle Problem
Date: Wed, 4 Nov 2009 16:30:20 +0000 (UTC)
Organization: Xoran Technologies
Lines: 33
Message-ID: <hcsa6s$kh$1@fred.mathworks.com>
References: <hcs617$2d9$1@fred.mathworks.com> <hcs98c$5q$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257352220 657 172.30.248.35 (4 Nov 2009 16:30:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Nov 2009 16:30:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:582435


"Rajeev Narayanan" <rite2rajeev@gmail.com> wrote in message <hcs98c$5q$1@fred.mathworks.com>...
> Hi,
> 
> Thanks for the reply. I think i didnt make it clear in my question. I have one more fucntion myfunc where i am using the parameter T and alpha. By passing it through the handle, the error i am getting is "T not defined"
> 
> 
> % FileName Parameter.m
> function[T, alpha] = Parameter()
> T = 0.000001;  
> alpha = 0.004;
> end
>  
> %FileName Top.m
>  fhandle = @Parameter
>  Q = myfunc(fhandle)
>  
> % FileName myfunc.m
> 
> function[X] = myfunc(T, alpha)
> 
> X = T/alpha ;
> 
> end
> 

I think this is the definition of myfunc that  you really want:

function [X] = myfunc(fhandle)

 [T,alpha]=fhandle();
  X = T/alpha ;

end