Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: index endpoint to matrix
Posted:
Feb 2, 2013 4:41 AM


Another method:
k = b > 0; c = b(k); l = diff([0 c]); m = bsxfun(@le,(1:max(l))',l); r = zeros(size(m)); r(m) = 1:c(end); a = zeros(length(b), max(l)); a(k,:) = r'
% Bruno



