How to expand a row of values into a matrix, such that each new value is equal to the value above it plus one?
What I’m asking for is a lot simpler to show than to explain. If I have a vector such as, for example:
[5 10 15]
How can I expand the vector for any integer length n (for this example let’s say n=3) into a matrix such that:
[5 10 15; 6 11 16; 7 12 17]
I know there’s a brute force solution with for-loops, but I’m trying to avoid for-loops where I can and stick to vectorization for efficiency. Is there anything I can use?What I’m asking for is a lot simpler to show than to explain. If I have a vector such as, for example:
[5 10 15]
How can I expand the vector for any integer length n (for this example let’s say n=3) into a matrix such that:
[5 10 15; 6 11 16; 7 12 17]
I know there’s a brute force solution with for-loops, but I’m trying to avoid for-loops where I can and stick to vectorization for efficiency. Is there anything I can use? What I’m asking for is a lot simpler to show than to explain. If I have a vector such as, for example:
[5 10 15]
How can I expand the vector for any integer length n (for this example let’s say n=3) into a matrix such that:
[5 10 15; 6 11 16; 7 12 17]
I know there’s a brute force solution with for-loops, but I’m trying to avoid for-loops where I can and stick to vectorization for efficiency. Is there anything I can use? matrix, vectorization MATLAB Answers — New Questions