MATLAB: Convert Two Arrays into One Matrix Containing Incremented Between Values

arraysconvertmatrix

Let's say I have:
i and I, such that I=i-10
i =
100
432
660
I =
90
422
650
And want Matlab to produce the following matrix:
90 91 92 93 94 95 96 97 98 99 100
422 423 424 425 426 427 428 429 430 431 432
650 651 652 653 654 655 656 657 658 659 660
How would I go about doing that? It seems like it should be pretty simple…

Best Answer

bsxfun(@plus, I, 0:i(1)-I(1))
Related Question