How would you fill columns first with a defined variable, then move down and fill by column first?
For instance, I have an array filled with 24 names (24x1) and I want to split the names into 4 groups (columns). I want 4 names in each column till the 24th name.
CodePudding user response:
There are two ways to do it
1.Transpose your matrix at the end:
example=example.'
or
example=transpose(example)
2.You can directly fill in column:
I write an example down there. The important part is a(it,1)=it
it=1;
while it~=25
a(it,1)= it;
it=it 1;
end
