鉴于myCellArray{10,3} = [];
,我想用连续的数字填写第一列(让我们说1到10)。我知道我可以这样做:
[myCellArray{1:10,1}] = deal(1,2,3,4,5,6,7,8,9,10)
myCellArray =
[ 1] [] []
[ 2] [] []
[ 3] [] []
[ 4] [] []
[ 5] [] []
[ 6] [] []
[ 7] [] []
[ 8] [] []
[ 9] [] []
[10] [] []
但是,如果我的单元格数组要大得多(比如1000行而不是10行),写出逗号分隔的值显然会变得单调乏味:
[myCellArray{1:10,1}] = deal(1,2,3,
... ,1000)
有没有办法创建这个以逗号分隔的"列表"数字自动?像(1:10)
这样的东西?我知道我可以通过循环分配值,但是有一个优雅的单行解决方案还是接近它的东西?