MATLAB Answers

Rita
0

How to solve this simple index problem

Asked by Rita
on 30 Aug 2015
Latest activity Commented on by Rita
on 30 Aug 2015
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

  0 Comments

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 30 Aug 2015
 Accepted Answer

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

  1 Comment

Rita
on 30 Aug 2015
Thanks a lot Walter

Sign in to comment.