sg-s/cpplab

When argument N = 1, don't throw assertion, just do nothing

Closed this issue · 1 comments

This way you can loop replicate without having to make a special exception for N=1.

function replicate(self,thing,N)


assert(isint(N),'N must be an integer >= 1')
assert(isscalar(N),'N must be an integer >= 1')
assert(N > 0,'N must be an integer >= 1')

if N == 1
	% do nothing
	return
end

git is giving me trouble right now, otherwise I'd submit the pull request myself...

sg-s commented

so you want to be able to do this:

x.replicate('AB',1)

?