如何先按列填充单元格?

how to fill cells by column first?

如何先用定义的变量填充列,然后向下移动并先按列填充?

例如,我有一个包含 24 个名称 (24x1) 的数组,我想将这些名称分成 4 组(列)。我希望每列有 4 个名字,直到第 24 个名字。

有两种方法可以做到

1.Transpose 你的矩阵在最后:

example=example.'

example=transpose(example)

2.You可以直接填列:

我在下面写了一个例子。重要的部分是a(it,1)=it

it=1;
while it~=25
    a(it,1)= it;
    it=it+1;
end