假设我有C单元,如下所述:
C =
[31, 17] [57, 17] [83, 17] [109, 17] [135, 17]
[31, 33] [57, 33] [83, 33] [109, 33] [135, 33]
[31, 49] [57, 49] [83, 49] [109, 49] [135, 49]
[31, 65] [57, 65] [83, 65] [109, 65] [135, 65]
[31, 81] [57, 81] [83, 81] [109, 81] [135, 81]
[31, 97] [57, 97] [83, 97] [109, 97] [135, 97]
[31, 113] [57, 113] [83, 113] [109, 113] [135, 113]
[31, 129] [57, 129] [83, 129] [109, 129] [135, 129]
[31, 145] [57, 145] [83, 145] [109, 145] [135, 145]
[31, 161] [57, 161] [83, 161] [109, 161] [135, 161]
[31, 177] [57, 177] [83, 177] [109, 177] [135, 177]
现在我想在新矩阵中提取所有数据 像这样:
C11 = ([31,17] [57,17]; [31,33] [57,33])
C12 = ([57,17] [83,17]; [57,33] [83,33])
C13 = ([83,17] [109,17]; [83,33] [109,33])
C14 = ([109,17] [135,17]; [109,33] [135,33])
C21 = ([31,33] [57,33]; [31,49] [57,49])
C22 = ([57,33] [83,33]; [57,49] [83,49])
C23 = ([83,33] [109,33]; [83,49] [109,49])
....... ........ ....... ...... ..
C104 = ([109,161] [135,161]; [109,177] [109,177])
如何在Matlab中做到这一点?
答案 0 :(得分:0)
使用圆括号的数组下标。例如,C12
将按如下方式计算:
>> C12(1:2, 2:3)
ans =
{ [ 57 17 ] [ 83 17 ] }
{ [ 57 33 ] [ 83 33 ] }
您可以执行for循环迭代单元格数组并逐个提取必要的单元格,并将每个单元格存储在不同的变量中。但是,所有数据都已存储C
,为什么要复制它?我建议您将所有内容保存在单元格数组中,并仅在需要时提取矩阵。