Re: why matlab give me a message "Undefined function or variable"?
- From: "Andy " <theorigamist@xxxxxxxxx>
- Date: Wed, 2 Sep 2009 13:04:04 +0000 (UTC)
"Yu Cheong Kim" <yustino_kr@xxxxxxxxx> wrote in message <h7la32$hso$1@xxxxxxxxxxxxxxxxxx>...
to.matt
first of all, i appreciate helping me.
your comment is perfect!
it gives me a big hint to solve my problem.
i'm considering whether or not using "global" command at test.m file.
yours sincerely,
Yu cheong.
% It sounds like in your situation you might be better off passing y as an optional
% parameter to your function:
function x=test(number,varargin)
if nargin==2
y=varargin{1};
else
y=1; % set a default value for y
end
x=y+number;
end
%{
% Sample output
ans =test(1)
2
ans =test(1,2)
3
%}
.
- References:
- why matlab give me a message "Undefined function or variable"?
- From: Yu Cheong Kim
- Re: why matlab give me a message "Undefined function or variable"?
- From: Matt Fig
- Re: why matlab give me a message "Undefined function or variable"?
- From: Yu Cheong Kim
- why matlab give me a message "Undefined function or variable"?
- Prev by Date: Re: Compiling multiple C files with S-Function
- Next by Date: Re: Difference Between QuadProg and FMINCON
- Previous by thread: Re: why matlab give me a message "Undefined function or variable"?
- Next by thread: parfor loop
- Index(es):
Relevant Pages
|