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:14:04 +0000 (UTC)
Organization: Concordia University
Lines: 63
Message-ID: <hcs98c$5q$1@fred.mathworks.com>
References: <hcs617$2d9$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257351244 186 172.30.248.38 (4 Nov 2009 16:14:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Nov 2009 16:14:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2076687
Xref: news.mathworks.com comp.soft-sys.matlab:582430


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


Thanks,
 Rajeev



















"Rajeev Narayanan" <rite2rajeev@gmail.com> wrote in message <hcs617$2d9$1@fred.mathworks.com>...
> Hi,
> 
> I have created the following function and need to be passed as a function handle and i am getting some errors. The parameters T and alpha are not visible in my Top.m. Can someone help me out?
> 
> % FileName Parameter.m
> function[T, alpha] = Parameter()
> T = 0.000001; 
> alpha = 0.004;
> end
> 
> %FileName Top.m
> 
> fhandle = @Parameter
> Q = myfunc(fhandle)
> 
> Thanks,
> Rajeev