How to retrieve only positive values with indexing in matrix

117 ビュー (過去 30 日間)
SANJOY MONDAL
SANJOY MONDAL 2019 年 7 月 11 日
コメント済み: SANJOY MONDAL 2019 年 7 月 11 日
I have a matrix like this
A=[ -1 -1 8 7 -1 11 4 3 -1 -1 6] i want to see only positive values with indexing.
output will be like this
B=[ 3 8
4 7
6 11
7 4
8 3
11 6]

採用された回答

Alex Mcaulley
Alex Mcaulley 2019 年 7 月 11 日
ind = find(A>0);
B = [ind',A(ind)']
A =
3 8
4 7
6 11
7 4
8 3
11 6

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by