在MATLAB的程序中,我发现了以下声明,但我无法弄清楚这意味着什么。
Z = A(xxx:xxx + w- 1, yyy:yyy+ w- 1, :);
A在索引中(n,n,3) xxx,yyy,w是整数
答案 0 :(得分:1)
A是3维矩阵。在该声明中,您正在从该矩阵中读取一系列单元格。在Matlab中a:b表示从a到b,而冒号(:)本身就意味着“一切都在'”。
Lets say that xxx=5, yyy=10 and w=2. Then in your case you are reading:
1st dimension (rows) : from 5 to 6 (6 = 5 + 2 - 1)
2nd dimension (columns) : from 10 to 11 (11 = 10 + 2 - 1)
3rd dimension (pages) : all of the pages.