Hello, I have array A 10×1 and array B 3×2 as below
A=[1; 2; 3; 4; 5; 6; 7; 8; 9; 10];B=[2 100; 4 500; 7 300];
I need to add to the A matrix the values according to the second column of B.
Output should be
A=[1 NaN; 2 100; 3 NaN; 4 500; 5 NaN; 6 NaN; 7 300; 8 NaN; 9 NaN; 10 NaN];
Cannot use ismember because I will have a 0 index (*)
Is there a way to solve this? Thanks
Best Answer