用matlab给三维数组中特定行列赋值
matlab使用sub2ind函数将特定行列赋值给三维数组
matlab用sub2ind函数将特定行列中的元素值赋为1,示例如下:
a=zeros(5);
i = [2;3;4];
j = [1;4;2];
a(sub2ind(size(a), i, j))=1
a = 0 0 0 1 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
用户上传资源,matlab三维数组,某几行或某几列,赋值,sub2ind函数
下载地址
用户评论