Effacer les filtres
Effacer les filtres

How to remove the values in vector 'B' corresponding to 'NaNs' in vector 'A'?

1 vue (au cours des 30 derniers jours)
abdur rauf
abdur rauf le 3 Juin 2018
Commenté : abdur rauf le 3 Juin 2018
Hello every one, I have two vectors as a sample
A=[10 12 15 NaN 20 30 46 NaN 12 10 NaN 9 8 7 8 NaN 51 Nan 24]
B=[11 73 24 36 47 18 29 31 52 44 33 22 28 16 15 13 19 18 13]
I can delete the 'NaNs' from vector 'A' by using a function
A(isnan(A)) = [];
but I also want to delete the values in vector 'B' corresponding to 'NaNS' in vector 'A'. I want to get
A=[10 12 15 20 30 46 12 10 9 8 7 8 51 24]
B=[11 73 24 47 18 29 52 44 22 28 16 15 19 13]
I do not know how to get it. Any help will be appreciated.
Thanks

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 3 Juin 2018
index=isnan(A)
B(index) = [];

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by