Effacer les filtres
Effacer les filtres

Finding a range in an array

3 vues (au cours des 30 derniers jours)
Wei Nick Chan
Wei Nick Chan le 17 Juin 2016
Commenté : Wei Nick Chan le 17 Juin 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!

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 17 Juin 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))
  1 commentaire
Wei Nick Chan
Wei Nick Chan le 17 Juin 2016
thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by