How to retrieve only positive values with indexing in matrix

24 Ansichten (letzte 30 Tage)
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]

Akzeptierte Antwort

Alex Mcaulley
Alex Mcaulley am 11 Jul. 2019
ind = find(A>0);
B = [ind',A(ind)']
A =
3 8
4 7
6 11
7 4
8 3
11 6

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by