MATLAB: Make column in a matrix: 1,1,1,2,2,2,3,3,3 etc

matrix

Hi,
I'm trying to create a matrix A(21,4). In the second column I want to insert the numbers 1,1,1,2,2,2,3,3,3 etc until the end of the column. Tried this:
A = zeros(21, 4);
A(:,2) = rem((0:size(imageInformation,1)-1)',7)+1;
Which creates the column 1,2,3,4,6,7,1,2,3 etc. How can I modify this/is there any way to write code which would input the previously mentioned numbers into the matrix?

Best Answer

A(:,2) = ceil((1:size(A,1))/3)