フィルターのクリア

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

1 回表示 (過去 30 日間)
abdur rauf
abdur rauf 2018 年 6 月 3 日
コメント済み: abdur rauf 2018 年 6 月 3 日
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

採用された回答

Fangjun Jiang
Fangjun Jiang 2018 年 6 月 3 日
index=isnan(A)
B(index) = [];

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by