MATLAB: How separate the first one (Xp) from (Xn).

complexdspDSP System ToolboxfbmcfftifftMATLABmatlab coderMotorola DSP Developers Kitnegativeofdmplotpositivestem

now when I compleat the first signal, But now I want to separate Xn from Xp in the following
rs=[Xn, Xp]
but the length of Xn and Xp is different, therefor we truck the length
XNsize = length(Xn);
rf =[XNsize, Xp, Xn];

Best Answer

I have no idea why you are trying to do this using a vector. Far better would be to store your variables in a struct or a cell array. For example,
rs = {Xn,Xp};
Now you can recover Xn of Xp as simply rs{1} or rs{2}.
Or use
rs.Xn = Xn;
rs.Xp = Xp;
Here you extract Xn or Xp using rs.Xn or rs.Xp.
In either case, Xn and Xp are easily extracted. You need never pack the length of Xn into the vector, a kludge that serves no purpose, since in order to use those variables, you need to unpack them anyway.
Can you unpack the result from the vector? OF COURSE YOU CAN! But the point is, packing it all into a vector serves no purpose, especially since you have no idea how to unpack them in the first place. Yes, you are still out there, asking but if I really, really, really must do it the way I desperately wanted to do it, how would I have solved the problem using the kludge of packing it all into a vector?
Xn = rf(2:rf(1)+1);
Xp = rf(2 + rf(1):end);
Again, better would be just to learn to use MATLAB. Then you don't need to use a kludge solution in the first place.