Sunday, April 4, 2010

Nested Function inside function

I had never done a nested function inside another.
It helps to avoid the necessity of having more files as m function. Useful when the function is only called by the same file.
However, the main file itself needs to be saved as function instead of script.


function test
home
a = 1;
b = 2;
test1 = istested(a,b)

function answer = istested(a,b)
a = a+1;
answer = isequal(a,b);
return

No comments: