How to construct an array from two arrays of different sizes using conditional replacement of elements?
6 views (last 30 days)
Show older comments
Emerson De Souza on 15 Oct 2012
Hi, I have two arrays A and B as below
Goal: I want to construct an array C with the same length as A. The elements of C equals the elements of the second column of B if the elements of the first column of A and the elements of the first column of B are equal. Otherwise, the elements of C is not available (NaN)
Thus, C should look like below:
I tried the following command lines:
C(i) = NaN;
but had no success yet. I wonder if someone could help me to correct the mistakes I have done or suggest something else that works.
I thank you in advance for you help
Azzi Abdelmalek on 15 Oct 2012
Edited: Azzi Abdelmalek on 15 Oct 2012
More Answers (0)
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!