Finding a range in an array
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Wei Nick Chan
il 17 Giu 2016
Commentato: Wei Nick Chan
il 17 Giu 2016
Hi MATLAB pros!
I have an array that's like this, it's a 3D plot converted into 2D pcolor plot
x =
11 15 16 18 20 25
y =
10 20 30 40 50
array =
0 0 0 1 2 3
0 0 1 2 4 5
2 3 4 5 6 7
1 2 3 4 5 6
5 6 8 7 5 4
I need the code to work so that it returns the x axis value and y axis value that don't contain any 0 values, it should be something like this:
x =
18 20 25
y =
30 40 50
Any leads for me to achieve this goal? help!
0 Commenti
Risposta accettata
Andrei Bobrov
il 17 Giu 2016
x =[ 11 15 16 18 20 25]
y =[10 20 30 40 50]
a =[0 0 0 1 2 3
0 0 1 2 4 5
2 3 4 5 6 7
1 2 3 4 5 6
5 6 8 7 5 4 ]
xout = x(all(a))
yout = y(all(a,2))
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!