找到索引矩阵Matlab

use*_*744 1 indexing matlab find

我有矩阵维度和find函数的问题.

对于每一行,我试图找到与大于20的值相关的索引,并将结果存储在另一个矩阵中.

例如:

A = [
    10  21  30
     1  40  50
     1   0   0 
    50  10   3];


index = 
    2 3 
    2 3
    0
    1
Run Code Online (Sandbox Code Playgroud)

有什么建议?

Sha*_*hai 5

使用findaccumarray

>> [r c] = find( A > 20 );
>> index = accumarray( r, c, [], @(x) {x} )

index = 
 [ 2, 3 ]
 [ 2, 3 ]
       []
 [    1 ]
Run Code Online (Sandbox Code Playgroud)

请注意,这index是一个酒窖.