Re: why matlab give me a message "Undefined function or variable"?



"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
test(1)
ans =
2
test(1,2)
ans =
3
%}
.



Relevant Pages

  • Re: Delphi Type Narrowing
    ... > an integer value into a word formal parameter. ... > Assignment statements should follow the same rules as passing parameters, ... So no compile-time warning, ... FPC produces a hint: ...
    (comp.lang.pascal.delphi.misc)
  • RE: [SLE] Problem with MySQL and Tomcat
    ... > What is the error message when you look at dmesg ... >> Can somebody give me a hint? ... Thankks in advance for helping. ...
    (SuSE)
  • Re: why matlab give me a message "Undefined function or variable"?
    ... first of all, i appreciate helping me. ... it gives me a big hint to solve my problem. ... i'm considering whether or not using "global" command at test.m file. ... Yu cheong. ...
    (comp.soft-sys.matlab)
  • Re: TZ88 DLT on RH 7.3
    ... >>Perhaps, it remains EOL, not more then a hint to the OP, found ... >>the answer amazing arrogant and decided to stop helping him, ...
    (comp.os.linux.misc)
  • Re: copy files using backupread and backupwrite api.
    ... > passing a buffer of type byte is not helping. ... My blog about Win32 and .NET ...
    (microsoft.public.win32.programmer.kernel)