MATLAB Answers

0

Merge two colums into one

Asked by René Dienemann on 26 Aug 2019
Latest activity Commented on by René Dienemann on 26 Aug 2019
Accepted Answer by Jan
Hi, I´m an absolutly matlab greenhorn. I hope its okay, if i ask some "maybe" stupid questions.
I have an array (6x2), in my example are these colums A and B, and I need an array (6x1) ... colum C.
How can I merge these two colums A and B to colum C?
Thanks for your help.
Best Regards
Example:
matlab_ex.jpg

  0 Comments

Sign in to comment.

Tags

1 Answer

Jan
Answer by Jan
on 26 Aug 2019
 Accepted Answer

Assuming that X is your matrix:
C = X(:, 2);
match = isnan(C);
C(match) = X(match, 1);

  1 Comment

perfect, thanks a lot !!!

Sign in to comment.