How to solve this simple index problem

Hi, I have
a=[1;2;3]and b=[23;nan;4]
how I can get these
c=[2] and also D=[1,23;3,4]
Thanks a lot

 採用された回答

Walter Roberson
Walter Roberson 2015 年 8 月 30 日

1 投票

idx = isnan(b);
c = a(idx);
D = [a(~idx), b(~idx)];

1 件のコメント

Rita
Rita 2015 年 8 月 30 日
Thanks a lot Walter

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeNumeric Types についてさらに検索

タグ

質問済み:

2015 年 8 月 30 日

コメント済み:

2015 年 8 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by