Think what happens for massa_pos when i=1. Nothing happens, because massa(i) is negative. But when you get to i=7, you then get massa_pos(7)=massa(7). What is matlab to think massa_pos(1:6) consists of, when you have not told anything about it? A vector will be filled with 0s as default.
In your example, you can add a running counter;
if massa(i) < 0
massa_neg(negcounter) = massa(i);
massa_pos(poscounter) = massa(i);
Alternatively, a more clean approach is to simply use logical indexing:
massa_neg=massa((massa < 0));
massa_pos=massa((massa >= 0));