Help with adding a column with numbers that are repeated to a matrix
Show older comments
Hi,
I have a 2170x1 matrix I need to create a new 2170x2 matric where I add numbers going from 1 to 12 in the second column all the way to row 2170. The thing is that when 12 is reached I need it to start at 1 again and so on until the end of my matrix is reached but I can't figure out how to do that.
Accepted Answer
More Answers (1)
Let's say your matrix is A,
A(:,2)=mod(0:2169,12)+1;
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!