MATLAB: How to add data in a matrice

matrices

I have just one input parameter: "Number of rows" How can i create such a matrice with 4 columns and this input data "1,2,3,4;5,6,7,8;9,10….. With a for loop?
F = [1,2,3,4;5,6,7,8;9,10,11,12;13,14,15,16;17,18,19,20;21,22,23,24;25,26,27,28;29,30,31,32];
thank you so much

Best Answer

  • without loop:
    F = reshape(1:32,4,[])';