Given a = [1, 7] and b = [4, 10], I want to create a new vector [1:4,7:10]. I can do this with a loop, but I was looking for vectorized solution. I tried using the bsxfun by defining the following function fun = @(c,d) c:d but then using bsxfun(fun, a, b). It generates 1:4 but not 7:10. Thanks.
See if this works for you -
Sample run -