ind2sub
[row,col] = ind2sub(sz,ind)
[I1,I2,…,In] = ind2sub(sz,ind)
[row,col] = ind2sub(sz,ind) returns the arrays row and col containing the equivalent row and column subscripts corresponding to the linear indices ind for a matrix of size sz. Here sz is a vector with two elements, where sz(1) specifies the number of rows and sz(2) specifies the number of columns.
[I1,I2,…,In] = ind2sub(sz,ind) returns n arrays I1,I2,…,In containing the equivalent multidimensional subscripts corresponding to the linear indices ind for a multidimensional array of size sz. Here sz is a vector with n elements that specifies the size of each array dimension.
将线性索引转换为三维数组的下标
ind = [3 4 5 6];
sz = [2 2 2];
[I1,I2,I3] = ind2sub(sz,ind)
最后
以上就是眯眯眼豆芽最近收集整理的关于matlab ind2sub的全部内容,更多相关matlab内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复