From: Aman on
i am trying to write a function.
function deepu = deepak(N,k,R,eta). When i am calling this function it gives the output. but it also gives the this error msg.
what should i do to make it correct.

Error in ==> deepak at 2
X=20*(rand(N,1));

??? Output argument "deepu" (and maybe others) not assigned during call to "D:\EWI-G422\My
Documents\MATLAB\InitExp\deepak.m (deepak)".

Error in ==> myfunctions at 9
deepu = deepak(50,2,8,4);

>>
From: Steven Lord on

"Aman " <am.amangupta(a)gmail.com> wrote in message
news:i11vhe$pkf$1(a)fred.mathworks.com...
>i am trying to write a function. function deepu = deepak(N,k,R,eta). When i
>am calling this function it gives the output. but it also gives the this
>error msg. what should i do to make it correct.
>
> Error in ==> deepak at 2
> X=20*(rand(N,1));
>
> ??? Output argument "deepu" (and maybe others) not assigned during call to
> "D:\EWI-G422\My
> Documents\MATLAB\InitExp\deepak.m (deepak)".
>
> Error in ==> myfunctions at 9
> deepu = deepak(50,2,8,4);

There is a path through your deepak function's code that when executed does
not assign a value to one or more of the output arguments specified on the
function declaration line [the line that looks like "function deepu =
deepak(..."]. Your mission is to determine why that code path does not
assign a value to that output argument and fix it.

As a simple example of the type of thing you're looking for:

function y = demonstrateProblem(x)
if x > 5
y = 1;
else
t = 2; % typo; should be "y = 2;"
end

If you call this function with x = 1, the variable y will never be assigned
a value (since the line t = 2 will execute instead of the line y = 1) and so
you will receive this error.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com