It's in the MatLab reference; "break is not defined outside a for or while loop. Use return in this context instead." =P
14 Dec 2006
Jarek is right, there are some issues, I'm not sure why the "break" statement doesn't work except maybe the function is expecting an output, so a "return" is needed. Other issues:
1) Rename Poissrnd.m to poissrnd.m, MatLab likes cases to match between the function name and the file, that should fix of Jarek's #4 issue.
2) On line 136, a "(" is misplaced, replace "if prod(size(lambda) == 1)" with "if prod(size(lambda)) == 1". This way, you are comparing the product of the row and column size of lambda to 1. The original line is trying to compare size of lambda to 1, but take the product of the comparison; which is not a correct input argument for "prod".
Other than that, thanks, saved me a trip home getting the file.
09 Aug 2006
Good useful code with many small annoyances. Needs tinkering to get to work. Some problems I run into with R2006a:
1) Error in line 82 a BREAK statement appeared has to be replaced with RETURN.
2) Error in line 136: something about 'prod' is not defined 'logical' values. To fix replace the whole ?prod()? statement with 0.
3) Name conflict with Matlab?s poissrnd ? had to rename function to something else to get to work without warnings.
4) Poissrnd(0) returned NaN while poissrnd(0) returned 0. More changes needed to fix.