Working with tables: populate column of NaNs in table 1, with contents of column of table 2, given a condition.
Show older comments
I have some data in testing.mat (uploaded to this thread), two tables with two common columns: 'letter' and 'vals'.
On t_1, my 'vals' column is full of NaNs, I'd like to fill it with the values of the 'vals' column of t_2. I managed to achieve this with a for loop and using strcmp.
My question for the forum is, is it possible to do this in a single line or two? Without "for" loops? I have not tried it yet, but outerjoin could help me, the thing is I think the command will leave the two 'vals' column if I do the merge using that key.
What do you recommend?
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!