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

 Accepted Answer

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

More Answers (0)

Categories

Asked:

on 30 Aug 2015

Commented:

on 30 Aug 2015

Community Treasure Hunt

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

Start Hunting!