What is the meaning in this instrument
1 回表示 (過去 30 日間)
古いコメントを表示
Alaaeldin Mohamed
2018 年 2 月 2 日
編集済み: Alaaeldin Mohamed
2018 年 2 月 2 日
I want to know the meaning of this MATLAB command
>> v = unique(m(d==1,2))
where m and d are matrices with dimensions (50x2) and (50x1) respectively.
0 件のコメント
採用された回答
Walter Roberson
2018 年 2 月 2 日
d == 1 where d is a vector, produces a logical vector as output -- a vector of true and false values.
When you use a logical vector as a subscript, that is called "logical indexing", and it selects for output all locations where the vector is true. In this context, those are used to select rows -- so the m(d==1,2) selects column 2 of all rows of m corresponding to the positions where d==1 is true.
v = unique(m(d==1,2))
acts the same as
temp = find(d==1);
v = unique(m(temp, 2))
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Operators and Elementary Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!