Although I have come up with a work-around using multiple if / else if
statements, I am curious in knowing what looks wrong with my case
statement
Building upon Suever's answer, and considering that you're actually trying to solve a data-binning problem, if you have R2015a or later, you can also use the built-in discretize function to achieve the same thing; e.g.:
function bucket = ri(ar_vo,edgz)
if nargin < 1
edgz = [0, 0.005, 0.02, 0.05, 0.1, 0.15, 0.25, inf];
end
bucket = discretize(ar_vo,edgz);
if isnan(bucket)
error('MATLAB:RI Bucket:NotAvailable.');
end
end