发布网友 发布时间:2024-10-22 21:45
共1个回答
热心网友 时间:2024-11-18 04:45
举个例子,从第二行第三列开始截取3行4列大小的部分:
>> a = randi( 7, 7 )
a =
1 1 4 5 6 6 6
1 5 6 5 2 5 3
5 4 2 3 2 5 6
3 6 2 5 2 3 1
3 1 6 3 5 5 5
7 3 6 4 1 2 7
1 4 3 1 6 4 2
>> lefti = 2, leftj = 3, row = 3, col = 4
lefti =
2
leftj =
3
row =
3
col =
4
>> partm = a( lefti : lefti + row - 1, leftj : leftj + col - 1 )
partm =
6 5 2 5
2 3 2 5
2 5 2 3