MATLAB: How to add zeros to 2 x vectors where there are no matches, to get the same length

plotx_datay_datazeros

x=[1 2 3 4];
y=[1 2 3 1];
x1=[3 4 5 6 7 8];
y1=[2 6 4 2 5 3];
[x, y, x1, y1] = Tout_Ajuster(x, y, x1, y1)
I want to put zeros where there is no match in x axes to get the same length for (x and x1) so I write a small code (Tout_Ajuster.m) in the output, x1 misses (5 and 6) so y1 miss(4 and 2) What is missing in my function < Tout_Ajuster.m > ???

Best Answer

In this example, Test_Ajuster.m is calling Tout_Ajuster.m