【问题标题】:what this stament means? Z = A(xxx:xxx + w- 1, yyy:yyy+ w- 1, :);这句话是什么意思? Z = A(xxx:xxx + w- 1, yyy:yyy+ w- 1, :);
【发布时间】:2017-02-27 07:24:21
【问题描述】:

在 MATLAB 的一个程序中,我找到了以下语句,但我无法弄清楚这是什么意思。

Z = A(xxx:xxx + w- 1, yyy:yyy+ w- 1, :);

A 在索引中 (n,n,3) xxx , yyy, w 是整数

【问题讨论】:

    标签: matlab indexing


    【解决方案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.
    

    【讨论】:

    • 这是一个tutorial,可能对您有用。另外,请点击非常好的图标将此问题标记为已回答
    猜你喜欢
    • 2015-01-05
    • 2010-11-19
    • 2016-08-15
    • 2020-02-15
    • 2018-08-06
    • 2015-03-26
    • 1970-01-01
    • 2021-12-24
    • 1970-01-01
    相关资源
    最近更新 更多